草庐IT

php - 如何在magento中做条件?

有一些代码是这样的:getChildHtml('product_additional_data')?>getChildHtml('upsell_products')?>我想在之前添加一个if条件.我该怎么做?谢谢你。当我添加以下代码时,它显示错误。为什么?getChildHtml('upsell_products'))):?>..... 最佳答案 来自PHP文档:Warningisset()onlyworkswithvariablesaspassinganythingelsewillresultinaparseerror.Forch

php - Woocommerce 使用复选框追加销售

我在为wordpress/woocommerce网站添加的新追加销售部分遇到问题。加售在产品页面上显示得很好,可以添加到购物车,但产品ID会附加在标签之后。请看附件照片;我正在使用的代码;函数.phpfunctionadd_upsells_to_cart($cart_item_key){global$woocommerce;if(empty($_REQUEST['upsells'])||!is_array($_REQUEST['upsells']))return;//Preventloop$upsells=$_REQUEST['upsells'];unset($_REQUEST['up