Page 1 of 2

[vQmod] Regular and Discount Prices 1.5.x

Posted: Sun Aug 28, 2011 10:09 am
by fido-x
Following from this thread: http://forum.opencart.com/viewtopic.php?f=22&t=22341, and at i2Paq's request, here's the vQmod to show the discounted amount and the percentage saved for special offer products and discounts.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Sun Aug 28, 2011 5:11 pm
by i2Paq
I think that a donation is well deserved: Done.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Aug 29, 2011 12:13 am
by fido-x
Thanks. Muchly appreciated.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Aug 29, 2011 2:39 am
by Jackcohen
May you show a screenshot of what this does exactly?

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Aug 29, 2011 3:07 am
by i2Paq
Jackcohen wrote:May you show a screenshot of what this does exactly?
Normal Price
Special Price
Money Saved
Discount Percentage

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Aug 29, 2011 4:24 am
by mkh
Thanks alot for this... Really a great module...

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Aug 29, 2011 5:52 am
by Maansy
Thanks fido-x
Will try it when I get back.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Thu Sep 08, 2011 9:53 pm
by Flap
Can anyone help me to add this to more languages? It works for english but when I copy code from english and use it for another languaget it simply disappear.

I made this:

Code: Select all

<modification>

	<id>Product Discount</id>
	<version>1.0.0</version>
	<vqmver>1.2.3</vqmver>
	<author>Fido-X</author>

	<file name="catalog/controller/product/product.php">
		<operation>
			<search position="after"><![CDATA[
			$this->data['text_tags'] = $this->language->get('text_tags');
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$this->data['text_discounted'] = $this->language->get('text_discounted');
			$this->data['text_percent_saved'] = $this->language->get('text_percent_saved');
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			$this->data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$this->data['discount_amount'] = $this->currency->format($this->tax->calculate(($product_info['price'] - $product_info['special']), $product_info['tax_class_id'], $this->config->get('config_tax')));
			$this->data['percent_savings'] = round((($product_info['price'] - $product_info['special']) / $product_info['price'] * 100));
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			foreach ($discounts as $discount) {
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$discount_amount = $this->currency->format($this->tax->calculate(($product_info['price'] - $discount['price']), $product_info['tax_class_id'], $this->config->get('config_tax')));
			$discount_amount = $this->currency->format($product_info['price'] - $discount['price']);
			$percent_savings = round((($product_info['price'] - $discount['price']) / $product_info['price'] * 100));
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			'quantity' => $discount['quantity'],
			]]></search>
			<add><![CDATA[
			// Added for discounts
			'discount_amount' => $discount_amount,
			'percent_savings' => $percent_savings,
			// End discounts addition
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Discount:';
			$_['text_percent_saved']  = 'Save:';
			]]></add>
		</operation>
	</file>
	
	[color=#FF0000]<file name="catalog/language/czech/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Ušetříte:';
			$_['text_percent_saved']  = 'Sleva:';
			]]></add>
		</operation>
	</file>	[/color]

	<file name="catalog/view/theme/default/template/product/product.tpl">
		<operation>
			<search position="after" index="1"><![CDATA[
			<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
			]]></search>
			<add><![CDATA[
			<!-- Discounted price -->
			<table>
			  <tr>
			    <td style="width: 80px;"><?php echo $text_discounted; ?></td>
			    <td><?php echo $discount_amount; ?></td>
			  </tr>
			  <tr>
			    <td><?php echo $text_percent_saved; ?></td>
			    <td><?php echo $percent_savings; ?>%</td>
			  </tr>
			</table>
			<!-- End discounted price -->
			]]></add>
		</operation>
		<operation>
			<search position="after" index="1"><![CDATA[
			<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
			]]></search>
			<add><![CDATA[
			<!-- Discounted price -->
			<table>
			  <tr>
			    <td style="width: 80px;"><?php echo $text_discounted; ?></td>
			    <td><?php echo $discount['discount_amount']; ?></td>
			  </tr>
			  <tr>
			    <td><?php echo $text_percent_saved; ?></td>
			    <td><?php echo $discount['percent_savings']; ?>%</td>
			  </tr>
			</table>
			<!-- End discounted price -->
			]]></add>
		</operation>
	</file>

</modification>

Code: Select all

<file name="catalog/language/czech/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Ušetříte:';
			$_['text_percent_saved']  = 'Sleva:';
			]]></add>
		</operation>
	</file>

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Sun Sep 18, 2011 12:09 am
by Eva30
Very nice one,just must have!
thank you.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Sep 19, 2011 4:33 pm
by smitch6
Hi i presume you put this in the vqmod/xml folder?

once it's install how do you do the discount thing?

thanks

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Tue Sep 20, 2011 10:16 pm
by smitch6
can anyone help with this please ???

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Wed Sep 21, 2011 2:20 am
by terrier
Go under product -> click on Special tab -> add your special price amount -> save

Go to your site and click on the product.. you should see a regular and discounted value -> with the discounted %

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Wed Sep 21, 2011 2:38 am
by smitch6
brill thanks :D

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Thu Sep 22, 2011 7:16 am
by Eva30
Flap wrote:Can anyone help me to add this to more languages? It works for english but when I copy code from english and use it for another languaget it simply disappear.

I made this:

Code: Select all

<modification>

	<id>Product Discount</id>
	<version>1.0.0</version>
	<vqmver>1.2.3</vqmver>
	<author>Fido-X</author>

	<file name="catalog/controller/product/product.php">
		<operation>
			<search position="after"><![CDATA[
			$this->data['text_tags'] = $this->language->get('text_tags');
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$this->data['text_discounted'] = $this->language->get('text_discounted');
			$this->data['text_percent_saved'] = $this->language->get('text_percent_saved');
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			$this->data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$this->data['discount_amount'] = $this->currency->format($this->tax->calculate(($product_info['price'] - $product_info['special']), $product_info['tax_class_id'], $this->config->get('config_tax')));
			$this->data['percent_savings'] = round((($product_info['price'] - $product_info['special']) / $product_info['price'] * 100));
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			foreach ($discounts as $discount) {
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$discount_amount = $this->currency->format($this->tax->calculate(($product_info['price'] - $discount['price']), $product_info['tax_class_id'], $this->config->get('config_tax')));
			$discount_amount = $this->currency->format($product_info['price'] - $discount['price']);
			$percent_savings = round((($product_info['price'] - $discount['price']) / $product_info['price'] * 100));
			// End discounts addition
			]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			'quantity' => $discount['quantity'],
			]]></search>
			<add><![CDATA[
			// Added for discounts
			'discount_amount' => $discount_amount,
			'percent_savings' => $percent_savings,
			// End discounts addition
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Discount:';
			$_['text_percent_saved']  = 'Save:';
			]]></add>
		</operation>
	</file>
	
	[color=#FF0000]<file name="catalog/language/czech/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Ušetříte:';
			$_['text_percent_saved']  = 'Sleva:';
			]]></add>
		</operation>
	</file>	[/color]

	<file name="catalog/view/theme/default/template/product/product.tpl">
		<operation>
			<search position="after" index="1"><![CDATA[
			<span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
			]]></search>
			<add><![CDATA[
			<!-- Discounted price -->
			<table>
			  <tr>
			    <td style="width: 80px;"><?php echo $text_discounted; ?></td>
			    <td><?php echo $discount_amount; ?></td>
			  </tr>
			  <tr>
			    <td><?php echo $text_percent_saved; ?></td>
			    <td><?php echo $percent_savings; ?>%</td>
			  </tr>
			</table>
			<!-- End discounted price -->
			]]></add>
		</operation>
		<operation>
			<search position="after" index="1"><![CDATA[
			<?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
			]]></search>
			<add><![CDATA[
			<!-- Discounted price -->
			<table>
			  <tr>
			    <td style="width: 80px;"><?php echo $text_discounted; ?></td>
			    <td><?php echo $discount['discount_amount']; ?></td>
			  </tr>
			  <tr>
			    <td><?php echo $text_percent_saved; ?></td>
			    <td><?php echo $discount['percent_savings']; ?>%</td>
			  </tr>
			</table>
			<!-- End discounted price -->
			]]></add>
		</operation>
	</file>

</modification>

Code: Select all

<file name="catalog/language/czech/product/product.php">
		<operation>
			<search position="before" index="1"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			// Added for discounts
			$_['text_discounted']     = 'Ušetříte:';
			$_['text_percent_saved']  = 'Sleva:';
			]]></add>
		</operation>
	</file>
how to make it multi lang?
(FR, NL, EN, DE, IT)
or maybe there is some way to make all vQmods multi lang?
most of the time some thinks are missing with translations (text_here, something_here) if you know what i mean.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Wed Oct 26, 2011 7:43 am
by prodac
Yeah, I was also wondering about using this for other languages that English... ANyone got a solution for that?

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Wed Oct 26, 2011 9:22 am
by marvmen21
I am not an expert, but it should be as easy as copying and pasting the language parts and changing the path to your custom language. If it is not working that way, then you need to check your language file, the code in the search tag might be different or not present in your language file; Therefore, vqmod is not finding the line and obviously not adding the code. Try changing...

Code: Select all

<search position="before" index="1"><![CDATA[
         // Entry
         ]]></search>
TO...

Code: Select all

<search position="after"><![CDATA[
         <?php
         ]]></search>
This way it works with any language file, and will add the code just after the opening tag.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Wed Oct 26, 2011 9:54 am
by prodac
I fixed the language problem by replacing the language name and the theme name in the xml file :)

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Fri Oct 28, 2011 3:09 am
by vickiowa
Hi...

excellent mod... I'm using OC 1.5.1.1 and Shoppica.net 1.0.9 (August release) theme.

Uploaded the XML file to the vqmod\xml folder but the discount absolute amount and discount % is not shown on the product page.

Does anyone who has successfully installed the module with Shoppica help?

Thanks, Vick

PS Would also like to know the PP to make a small donation.

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Sat Oct 29, 2011 1:57 am
by wired-circuit
I have the same issue as vickiowa

Re: [vQmod] Regular and Discount Prices 1.5.x

Posted: Mon Nov 28, 2011 7:09 am
by snoopster
Can this mod be adjusted for 'Featured module' ? Because I tried it just for the percentage saving and it shows the same percentage for all the products in the featured area.

A little help would be appreciated.

Thank you very much.