gpt4 book ai didi

Script in Opencart(OpenCart中的脚本)

转载 作者:bug小助手 更新时间:2023-10-25 16:33:16 24 4
gpt4 key购买 nike



I hope you can help me with the following, I have tried many ways but I have not succeeded.

我希望你能在以下方面帮助我,我已经尝试了很多方法,但都没有成功。


Basically my need is for the var product_mpn = ""; of the script to automatically read each "product-model" of each product that is entered of Opencart

基本上,我需要的是脚本的var product_mpn=“”;来自动读取OpenCart中输入的每个产品的每个“product-Model


<script type="text/javascript">
jQuery("#DescriptionSectionOfYourPage").prepend("<div id=\"flix-inpage\"></div>");
jQuery("#AbovethefoldOfYourPage").prepend("<div id=\"flix-minisite\"></div>");
var product_mpn = "MODEL PRODUCT OF OPENCART";
var product_ean = "Dynamically add your product EAN";
var product_brand = "Dynamically add brand name";
var distributor = "xx";
var language = "xx";
var fallback_language = "xx";
var headID = document.getElementsByTagName("head")[0];
var flixScript = document.createElement('script');
flixScript.type = 'text/javascript';
flixScript.async = true;
flixScript.setAttribute('data-flix-distributor', distributor);
flixScript.setAttribute('data-flix-language', language);
flixScript.setAttribute('data-flix-fallback-language', fallback_language);
flixScript.setAttribute('data-flix-brand', product_brand);
flixScript.setAttribute('data-flix-ean', product_ean);
flixScript.setAttribute('data-flix-mpn', product_mpn);
flixScript.setAttribute('data-flix-inpage', 'flix-inpage');
flixScript.setAttribute('data-flix-button', 'flix-minisite');
flixScript.setAttribute('data-flix-price', '');
headID.appendChild(flixScript);
flixScript.src = '//media.flixfacts.com/js/loader.js';
</script>

I have trying with

我已经试过了


var product_mpn = <?php echo $model; ?>;

but doesn't work

但不起作用


更多回答

Which version of OpenCart you are use? Anyway if you need to get some value in template you need to declare it in corresponding controller file. In your case in controller file should be string like this: $data['model'] = $model; // $model should be retrieved from DB

您使用的是哪个版本的OpenCart?无论如何,如果您需要在模板中获取一些值,则需要在相应的控制器文件中声明它。在您的例子中,控制器文件中的字符串应该是这样的:$data[‘Model’]=$Model;//$Model应该从数据库中检索

Thanks for the response, I tried this and other ways but they didn't work either unfortunately

谢谢你的回应,我试过这种和其他方法,但不幸的是,它们也不起作用

优秀答案推荐

You could write it this way:

你可以这样写:


var product_mpn = "' + <?php echo $model; ?> + '";

更多回答

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com