change-price-options-in-opencart-2-to-total-amount
General

Change Price Options in OpenCart +2 to Total Amount

Show Total Price on Selection of Available OptionsShow Total Price on Selection of Available Options

The below code will help you to make an auto functionality in your OpenCart. This simple Mod will convert available option’s price e.g. +2, +4, +500 to Total Price (Actual Price of Default Product + Available Option).

Example:

Product: $10.00
Size
- Md (+$4.00)
- Lg (+$8.00)

Will Convert The Above Prices to

Product: 10.00
Size
- Md ($14.00)
- Lg ($18.00)

Follow the instructions below to make this functionality;

First of All VQmod Should be installed & below code is compatible with OpenCart Version 1.5.1.x – 2.0.3.x

  • Connect with FTP or access your CPanel > File Manager > Public_html
  • Go to vqmod > xml > Create New File with the name of “Auto_Currency.xml”
  • Select the File And Click on Edit
  • Insert the below code into file

Show Full Prices in Available Options


<?xml version="1.0" encoding="UTF-8"?>


<modification>

<id>Show Full Prices in Available Options</id>
 
<version>1</version>
 
<vqmver>2.5.1</vqmver>
 
<author>Mr. A.Q</author>
 
<file name="catalog/controller/product/product.php">
 
 <operation info="1.5.x" error="skip">
 
 <search position="after"><![CDATA[
foreach ($option['option_value'] as $option_value)
]]></search>
 <add><![CDATA[if ($option_value['price_prefix'] == '-') {$option_value['price'] = (($product_info['special'] ? ($product_info['special'] - $option_value['price']) : ($product_info['price']) - $option_value['price']));
} elseif ($option_value['price_prefix'] == '+') {$option_value['price'] = (($product_info['special'] ? ($product_info['special'] + $option_value['price']) : ($product_info['price']) + $option_value['price']));}

$option_value['price_prefix'] = '';
]]></add>
</operation>

<operation info="2.x" error="skip">

<search position="after"><![CDATA[foreach ($option['product_option_value'] as $option_value) {]]></search>
 <add><![CDATA[
if ($option_value['price_prefix'] == '-') {$option_value['price'] = (($product_info['special'] ? ($product_info['special'] - $option_value['price']) : ($product_info['price']) - $option_value['price']));
} elseif ($option_value['price_prefix'] == '+') {$option_value['price'] = (($product_info['special'] ? ($product_info['special'] + $option_value['price']) : ($product_info['price']) + $option_value['price']));}
 $option_value['price_prefix'] = '';]]></add>
</operation>
</file>

</modification>

Comment For SupportComment For Support

Summary
Article Name
Change Price Options in OpenCart +2 to Total Amount
Description
Change Price Options in OpenCart +2 to Total Amount Example: Product: $10.00 Size - Md (+$4.00) - Lg (+$8.00) Will Convert The Above Prices to: Product: 10.00 Size - Md ($14.00) - Lg ($18.00)
Author
Publisher Name
Adnan Qaiser
Publisher Logo

Leave a Reply