Post by fido-x » Sun Aug 28, 2011 10:09 am

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.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by i2Paq » Sun Aug 28, 2011 5:11 pm

I think that a donation is well deserved: Done.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by fido-x » Mon Aug 29, 2011 12:13 am

Thanks. Muchly appreciated.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by Jackcohen » Mon Aug 29, 2011 2:39 am

May you show a screenshot of what this does exactly?

Active Member

Posts

Joined
Sun Aug 07, 2011 1:08 pm

Post by i2Paq » Mon Aug 29, 2011 3:07 am

Jackcohen wrote:May you show a screenshot of what this does exactly?
Normal Price
Special Price
Money Saved
Discount Percentage

Attachments

ScreenHunter_01 Aug. 28 21.05.gif

ScreenHunter_01 Aug. 28 21.05.gif (2.35 KiB) Viewed 16782 times


Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by mkh » Mon Aug 29, 2011 4:24 am

Thanks alot for this... Really a great module...

mkh
New member

Posts

Joined
Fri Jun 24, 2011 1:55 am

Post by Maansy » Mon Aug 29, 2011 5:52 am

Thanks fido-x
Will try it when I get back.

ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com


User avatar
Active Member

Posts

Joined
Thu Jun 24, 2010 6:04 am


Post by Flap » Thu Sep 08, 2011 9:53 pm

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>

Newbie

Posts

Joined
Thu Sep 08, 2011 9:51 pm

Post by Eva30 » Sun Sep 18, 2011 12:09 am

Very nice one,just must have!
thank you.

User avatar
New member

Posts

Joined
Fri Sep 09, 2011 4:17 pm

Post by smitch6 » Mon Sep 19, 2011 4:33 pm

Hi i presume you put this in the vqmod/xml folder?

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

thanks

www.pattestersuffolk.co.uk


Active Member

Posts

Joined
Sat Sep 17, 2011 2:46 pm


Post by smitch6 » Tue Sep 20, 2011 10:16 pm

can anyone help with this please ???

www.pattestersuffolk.co.uk


Active Member

Posts

Joined
Sat Sep 17, 2011 2:46 pm


Post by terrier » Wed Sep 21, 2011 2:20 am

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 %

New member

Posts

Joined
Wed Aug 31, 2011 7:05 pm

Post by smitch6 » Wed Sep 21, 2011 2:38 am

brill thanks :D

www.pattestersuffolk.co.uk


Active Member

Posts

Joined
Sat Sep 17, 2011 2:46 pm


Post by Eva30 » Thu Sep 22, 2011 7:16 am

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.

User avatar
New member

Posts

Joined
Fri Sep 09, 2011 4:17 pm

Post by prodac » Wed Oct 26, 2011 7:43 am

Yeah, I was also wondering about using this for other languages that English... ANyone got a solution for that?

Newbie

Posts

Joined
Wed Oct 26, 2011 7:37 am

Post by marvmen21 » Wed Oct 26, 2011 9:22 am

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.

You want to thank me for my time! :) Click here to donate


Active Member

Posts

Joined
Tue Nov 09, 2010 4:54 am

Post by prodac » Wed Oct 26, 2011 9:54 am

I fixed the language problem by replacing the language name and the theme name in the xml file :)

Newbie

Posts

Joined
Wed Oct 26, 2011 7:37 am

Post by vickiowa » Fri Oct 28, 2011 3:09 am

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.

Newbie

Posts

Joined
Tue Sep 27, 2011 6:16 am

Post by wired-circuit » Sat Oct 29, 2011 1:57 am

I have the same issue as vickiowa

New member

Posts

Joined
Thu Mar 24, 2011 2:48 pm

Post by snoopster » Mon Nov 28, 2011 7:09 am

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.

New member

Posts

Joined
Mon Nov 28, 2011 7:06 am
Who is online

Users browsing this forum: No registered users and 3 guests