1

There is a php vqmod that adds how much of a discount a person gets for quantity but I need to to also have another thing that says "15% OFF if you share us, new price $HERE"

I just need the PHP modified so the it takes the regular price of the item and calculate how much it cost with a 15% discount and display the discounted price . Here is the code of the php vqmod. can anyone please help me?

<?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>
A J
  • 3,970
  • 14
  • 38
  • 53
IncRediblE
  • 11
  • 3

0 Answers0