我正在做一個opencart項目的更新。我們將創建將應用折扣的優惠券。它包含在結帳頁面中。我們在管理員端添加了優惠券詳細信息,例如優惠券代碼,折扣,exp date等,但用戶端沒有任何反應。同時輸入優惠券代碼沒有任何反應價格沒有降低,我們也沒有收到任何錯誤信息。優惠券在opencart中不起作用
1
A
回答
4
優惠券的正常工作方式確實使其無效。原因是日期有點尷尬。您需要將開始日期設置爲一天後才能使用,並將結束日期設置爲一天後。這很奇怪,我知道,但這是它的工作原理,所以要確保日期是有效的優惠券
0
擴大周杰倫的答案的方式......
如果是日期的問題,這是因爲Opencart的希望優惠券是大於/小於(不等於)的日期
打開/catalog/model/checkout/coupon.php
首先功能應當getCoupon
找到這行:
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon WHERE code = '" . $this->db->escape($code) . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) AND status = '1'");
變化DATE_START < NOW()到DATE_START < = NOW()
而且DATE_END < NOW()到DATE_END < = NOW()
導致:
$coupon_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "coupon WHERE code = '" . $this->db->escape($code) . "' AND ((date_start = '0000-00-00' OR date_start <= NOW()) AND (date_end = '0000-00-00' OR date_end >= NOW())) AND status = '1'");
3
剛剛有一個類似的問題,優惠券申請成功但沒有折扣。
發現問題是由於訂單總訂購的方式,'小計'需要在'優惠券'之前。
感覺不對發佈的答案沒有任何代碼,所以這裏是我做了我的調試:目錄/模型/總/ coupon.php
的$總數爲0,這樣的折扣是越來越復位。
public function getTotal(&$total_data, &$total, &$taxes) {
if (isset($this->session->data['coupon'])) {
$this->load->language('total/coupon');
$this->load->model('checkout/coupon');
$coupon_info = $this->model_checkout_coupon->getCoupon($this->session->data['coupon']);
if ($coupon_info) {
$discount_total = 0;
if (!$coupon_info['product']) {
$sub_total = $this->cart->getSubTotal();
} else {
$sub_total = 0;
foreach ($this->cart->getProducts() as $product) {
if (in_array($product['product_id'], $coupon_info['product'])) {
$sub_total += $product['total'];
}
}
}
if ($coupon_info['type'] == 'F') {
$coupon_info['discount'] = min($coupon_info['discount'], $sub_total);
}
foreach ($this->cart->getProducts() as $product) {
$discount = 0;
if (!$coupon_info['product']) {
$status = true;
} else {
if (in_array($product['product_id'], $coupon_info['product'])) {
$status = true;
} else {
$status = false;
}
}
if ($status) {
if ($coupon_info['type'] == 'F') {
$discount = $coupon_info['discount'] * ($product['total']/$sub_total);
} elseif ($coupon_info['type'] == 'P') {
$discount = $product['total']/100 * $coupon_info['discount'];
}
if ($product['tax_class_id']) {
$tax_rates = $this->tax->getRates($product['total'] - ($product['total'] - $discount), $product['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$taxes[$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
}
$discount_total += $discount;
}
if ($coupon_info['shipping'] && isset($this->session->data['shipping_method'])) {
if (!empty($this->session->data['shipping_method']['tax_class_id'])) {
$tax_rates = $this->tax->getRates($this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']);
foreach ($tax_rates as $tax_rate) {
if ($tax_rate['type'] == 'P') {
$taxes[$tax_rate['tax_rate_id']] -= $tax_rate['amount'];
}
}
}
$discount_total += $this->session->data['shipping_method']['cost'];
}
// If discount greater than total
if ($discount_total > $total) {
$discount_total = $total;
}
$total_data[] = array(
'code' => 'coupon',
'title' => sprintf($this->language->get('text_coupon'), $this->session->data['coupon']),
'value' => -$discount_total,
'sort_order' => $this->config->get('coupon_sort_order')
);
$total -= $discount_total;
}
}
}
0
從約翰的回答繼...在catalog/model/total/coupon.php
我換出
// If discount greater than total
if ($discount_total > $total) {
$discount_total = $total;
}
爲:
// If discount greater than total
if ($coupon_info['type'] == 'F' && $discount_total > $subtotal) {
$discount_total = $subtotal;
}
希望沒有人曾經有調試這一個!
相關問題
- 1. 如何獲取外部頁面優惠券/優惠券表單以在OpenCart中工作?
- 2. 如何刮優惠券網站的優惠券代碼(優惠券代碼亮起點擊按鈕)
- 3. 優惠券代碼
- 4. Magento優惠券getDiscountAmount()?
- 5. magento優惠券代碼新規則功能不起作用
- 6. 優惠券使用前頁
- 7. 應用條紋優惠券
- 8. 使用優惠券價值時的Opencart計算?
- 9. 生成優惠券代碼
- 10. 優惠券代碼統計
- 11. HTML \ CSS優惠券腳本
- 12. iPhone的優惠券更新
- 13. Woocommerce優惠券代碼
- 14. 折扣優惠券Project-.nextGaussian()
- 15. Magento創建優惠券
- 16. 優惠券總是結賬
- 17. woocommerce將車優惠券
- 18. Joomla Virtuemart特殊優惠券
- 19. Chargify API優惠券創建
- 20. Magento的 - 優惠券問題
- 21. 創建優惠券代碼
- 22. 在WooCommerce中設置優惠券說明
- 23. Prestashop優惠券塊不顯示
- 24. woocommerce 2.1不承認優惠券
- 25. 如何通過優惠券代碼獲得優惠券折扣金額?
- 26. 多個產品的多張優惠券或同一張優惠券
- 27. 應用內結算的優惠券
- 28. 優惠券沒有得到應用?
- 29. 應用WooCommerce優惠券代碼結帳
- 30. wordpress中的優惠券插件問題
你需要調試你的代碼。你確定你能看到錯誤信息嗎? – 2012-02-16 05:29:25
沒有收到任何錯誤消息 – Natasha 2012-02-16 06:25:03
錯誤報告級別,display_errors ini標誌和數據庫錯誤如何? – 2012-02-16 06:31:10