【发布时间】:2015-04-19 20:38:41
【问题描述】:
在 prestashop 中,我想在我的付款模块中获取准确的付款详细信息步骤数据。所以我只是从 order-payment.tpl 复制了代码,并在我的支付执行 smarty 文件中使用了它。它显示了几个错误。所以我只是浏览代码并从购物车中获取这些值,然后将其从我的支付控制器分配给 smarty 模板。一切正常,但我仍然收到一个名为
的错误Undefined index: gift_products .
当我检查 Cart.php 中的代码时,我得到了这样的结果
$gift_products = array();
$gift_product = $product;
$gift_product['cart_quantity'] = 1;
$gift_product['price'] = 0;
$gift_product['price_wt'] = 0;
$gift_product['total_wt'] = 0;
$gift_product['total'] = 0;
$gift_product['gift'] = true;
$gift_products[] = $gift_product;
I tried to assign the value of gift_products to the smarty like this
public function initContent()
{
parent::initContent();
$cart = $this->context->cart;
$this->context->smarty->assign(array(
'gift_products' => $cart->gift_products,
));
$this->setTemplate('payment_execution.tpl');
}
但它根本不起作用。有人可以告诉我如何在我的模块中使用购物车的变量/数组吗?任何帮助和建议都将是非常可观的。谢谢。
【问题讨论】:
标签: php prestashop prestashop-1.6