如何获得特殊日期?
How to get special dates?
我正在尝试获取产品页面上特殊 $date_start
和 $date_end
的价值。我正在使用 opencart 2.0x 版。请手动帮助谢谢。
For Special price date
为前任创建您自己的ocmod file
。 special_price.ocmod.xml
,粘贴以下代码并从 extension installer
安装
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[<font color="#0000"><b>Special Price</font>]]></name>
<version><![CDATA[<b>1.0</b>]]></version>
<code>specialprice_dates</code>
<author><![CDATA[<font color="#CC0000"><b>A2bizz Blogs</b></font>]]></author>
<link><![CDATA[http://blogs.a2bizz.com]]></link>
<file path="catalog/controller/product/product.php">
<operation error="skip">
<search><![CDATA[ $data['discounts'] = array(); ]]></search>
<add position="before" ><![CDATA[
if($data['special']){
$special_info = $this->model_catalog_product->getSpecialPriceInfo($this->request->get['product_id']);
}else{
$special_info = '';
}
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[ 'special' => $special, ]]></search>
<add position="after" ><![CDATA[
'special_info' => $special_info,
]]></add>
</operation>
</file>
<file path="catalog/model/catalog/product.php">
<operation error="skip">
<search><![CDATA[ public function getLatestProducts($limit) { ]]></search>
<add position="before" ><![CDATA[
public function getSpecialPriceInfo($product_id){
$sql = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product_special WHERE product_id = '".$product_id."'");
return $sql->row;
}
]]></add>
</operation>
</file>
</modification>
在product.tpl
中添加以下代码
<?php if ($product['special_info']) { ?>
<p><?php echo "<pre>"; print_r($product['special_info']); exit;?></p>
<?php } ?>
在这里您可以获得特价信息。
我正在尝试获取产品页面上特殊 $date_start
和 $date_end
的价值。我正在使用 opencart 2.0x 版。请手动帮助谢谢。
For Special price date
为前任创建您自己的ocmod file
。 special_price.ocmod.xml
,粘贴以下代码并从 extension installer
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[<font color="#0000"><b>Special Price</font>]]></name>
<version><![CDATA[<b>1.0</b>]]></version>
<code>specialprice_dates</code>
<author><![CDATA[<font color="#CC0000"><b>A2bizz Blogs</b></font>]]></author>
<link><![CDATA[http://blogs.a2bizz.com]]></link>
<file path="catalog/controller/product/product.php">
<operation error="skip">
<search><![CDATA[ $data['discounts'] = array(); ]]></search>
<add position="before" ><![CDATA[
if($data['special']){
$special_info = $this->model_catalog_product->getSpecialPriceInfo($this->request->get['product_id']);
}else{
$special_info = '';
}
]]></add>
</operation>
<operation error="skip">
<search><![CDATA[ 'special' => $special, ]]></search>
<add position="after" ><![CDATA[
'special_info' => $special_info,
]]></add>
</operation>
</file>
<file path="catalog/model/catalog/product.php">
<operation error="skip">
<search><![CDATA[ public function getLatestProducts($limit) { ]]></search>
<add position="before" ><![CDATA[
public function getSpecialPriceInfo($product_id){
$sql = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "product_special WHERE product_id = '".$product_id."'");
return $sql->row;
}
]]></add>
</operation>
</file>
</modification>
在product.tpl
中添加以下代码<?php if ($product['special_info']) { ?>
<p><?php echo "<pre>"; print_r($product['special_info']); exit;?></p>
<?php } ?>
在这里您可以获得特价信息。