有一个php vqmod
可以增加一个人获得的数量折扣,但我还需要另外一件事"15% OFF if you share us, new price $HERE"
我只需要修改PHP,这样它就需要物品的正常价格,并以15%的折扣计算成本并显示折扣价。这是php vqmod
的代码。有人可以帮帮我吗?
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<code>you_save</code>
<name>You Save OCMOD Product (edited red)</name>
<version>1.1.0</version>
<author>Sam custom</author>
<link></link>
<file path="catalog/controller/product/product.php">
<operation>
<search><![CDATA[
$data['text_tags'] = $this->language->get('text_tags');
]]></search>
<add position="after"><![CDATA[
$data['text_you_save'] = $this->language->get('text_you_save');
$data['text_you_save_or'] = $this->language->get('text_you_save_or');
]]></add>
</operation>
<operation>
<search><![CDATA[
$data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
]]></search>
<add position="after"><![CDATA[
$data['you_save'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')) - $this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
$data['you_save_or'] = round((($product_info['price'] - $product_info['special']) / $product_info['price'] * 100));
]]></add>
</operation>
<operation>
<search><![CDATA[
foreach ($discounts as $discount) {
]]></search>
<add position="after"><![CDATA[
$you_save = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')) - $this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
if ($product_info['price'] == 0) { $you_save_or = 0; } else { $you_save_or = round((($product_info['price'] - $discount['price']) / $product_info['price'] * 100)); }
]]></add>
</operation>
<operation>
<search><![CDATA[
'quantity' => $discount['quantity'],
]]></search>
<add position="after"><![CDATA[
'you_save' => $you_save,
'you_save_or' => $you_save_or,
]]></add>
</operation>
</file>
<file path="catalog/language/english/product/product.php">
<operation>
<search><![CDATA[
// Entry
]]></search>
<add position="before"><![CDATA[
$_['text_you_save'] = 'You save:';
$_['text_you_save_or'] = 'or';
]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/product/product.tpl">
<operation>
<search><![CDATA[
<h2><?php echo $special; ?></h2>
]]></search>
<add position="after"><![CDATA[
</li><li><span style="font-size:12px;font-weight:600;color:red"><?php echo $text_you_save; ?></span> <span style="font-size:12px;font-weight:400"><?php echo $you_save; ?> <?php echo $text_you_save_or; ?> <?php echo $you_save_or; ?>%</span>
]]></add>
</operation>
<operation>
<search><![CDATA[
<li><?php echo $discount['quantity']; ?><?php echo $text_discount; ?><?php echo $discount['price']; ?></li>
]]></search>
<add position="after"><![CDATA[
<li><span style="font-size:12px;font-weight:600;color:red"><?php echo $text_you_save; ?></span> <span style="font-size:12px;font-weight:400"><?php echo $discount['you_save']; ?> <?php echo $text_you_save_or; ?> <?php echo $discount['you_save_or']; ?>%</span></li>
]]></add>
</operation>
</file>
</modification>