我正在尝试为我的自定义结帐表单添加折扣我已使用商业折扣它在我的本地drupal 7与商业安装工作正常。所以我试过在cab网站上,但在实际网站上没有添加折扣金额。 所以我在折扣规则上添加了测试操作,以在网站上显示“已添加折扣”的消息 消息显示的更令人困惑的是,这意味着规则正在运行,但折扣并未添加 找到我用于将产品添加到购物车的以下代码
function xxx_commerce_cart_product_add($order, $product, $quantity, $line_item) {
if ($product->type == 'xxx') {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
if ($line_item_wrapper->commerce_product->product_id->value() == $product->product_id) {
$miles = $_SESSION['booking']['miles'];
$title = $line_item_wrapper->line_item_label->value();
$line_item_wrapper->line_item_label->set($title);
$line_item_wrapper->quantity->set($miles);
$line_item_wrapper->save();
}
else {
// only one cab can be booked in an order, so remove any other cab added previously.
commerce_cart_order_product_line_item_delete($order, $line_item_wrapper->line_item_id->value());
}
}
$checkout_panes = &drupal_static('commerce_checkout_panes');
unset($checkout_panes);
}
if(arg(0) == 'system') { // on homepage, we have action url to system/ajax for add to cart form.
// so to avoid viewing a non-viewable path, we are redirecting it here.
drupal_goto('checkout');
}
elseif(arg(0) =='checkout'){
drupal_goto($_SERVER['REQUEST_URI']);
}
}`
如何解决上述问题
我有什么遗漏
请指出正确的方向