如何根据产品id为woocommerce产品属性定义类?

vkc1a9a2  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(208)

我有一个脚本,它需要基于产品id的动态值。

<script type='text/javascript'>
  var ccs_cc_args = ccs_cc_args || []       
  ccs_cc_args.push(['cpn', 'CPN']);         ///Dynamically replace the CPN text
  ccs_cc_args.push(['mf', 'MFR_NAME']);     //Dynamically replace the MFR_NAME text
  ccs_cc_args.push(['pn', 'MPN']);          //Dynamically replace the MPN text
      ccs_cc_args.push(['market', 'PH']);

      (function () {
         var o = ccs_cc_args; o.push(['_SKey', '6ad5831c']); o.push(['_ZoneId', 'hp-auto-pp']);
         var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.async = true;
         sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.cnetcontent.com/jsc/h.js';
         var n = document.getElementsByTagName('script')[0]; n.parentNode.insertBefore(sc, n);
      })();
</script>

我已经找到了一个解决方案,其中的值被php文件中定义的类替换,比如这个,并将脚本中的值替换为定义的class.text

<div class="productboxArticlenumber">MLH82N/A</div>

但我无法确定产品属性项是什么类,因为它们以这样的表格格式返回,以及如何使其引用产品id。

<tr class="woocommerce-product-attributes-item woocommerce-product-attributes-item--attribute_pa_brand">
        <th class="woocommerce-product-attributes-item__label">Brand</th>
        <td class="woocommerce-product-attributes-item__value"><p>Huawei</p>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题