| How to Install Discount Module For Virtuemart |
Latest version 1.1Virtuemart version 1.1.3Follow the same instructions below for upgrade, skip the Step 4 (Running SQL queries Modifying Database) only if you are upgrading. Note: If you are facing problems in implementation of this module, I will do it for you, Please Contact me here Step 1 (Download)First you will need to download the files here Step 2 (Replacing Old Files)Now Please take the backup of all files and database ... If you cannot take backup of whole site take the back of at least vituemart component foldes which are administrator/components/com_virtuemart Step 3 (Hacking files)Note: If your virtuemart code is already modified by installation of some other module , Please don't replace the files by unzipping, But add the code in each file by editing the files mentioned below, You can trace code by searching for //binary added comment After Downloading, unzip the files in your joomla root directory ...(By removing the vmdiscount_vx_x.zip from unzip path) If you do it the correct way, The files listed below will replace the old files of virtuemart, Please take backup before unzipping. If you dont have unzip feature and you have just FTP just unzip somewhere ( desktop) and upload the directories through FTP... Like upload the directory /administrator, it will prompt that administrator directory already exists do you want to replace it? , Just click yes , Your whole administrator directory will not be replaced, only the files listed below will be replaced, But a backup is must.Do the same with components directory. Note: To unzip properly you must make sure that it do not create a separate folder in your root directory. Note: The Changes and modifications can be traced by looking for the comment code: //binary added List of files which will be modified
Step 4 (Running SQL queries Modifying Database)You can skip this step if you are performing an upgrade Now either import the provided sql "database.sql" file in phpmyadmin or open the file, copy the sql queries and run it from phpmyadmin (Backup is must) Step 5 (Creating Functions)
Now you will be able to see The new pane with title Discount Note: I am using Simple Layout
Now before we start using it we will need to register some functions
To create function please do as follows
Now click on the "Function list" of the Discount Module in the list.
and create a new fuctions
Function Name: addDiscount Note: You should create the above functions exactly as mentioned. We are almost done, now you can add, delete, update discounts which will apply Globally to all products Step 7 (Modify Paypal payment method)Now we have to modify the paypal payment extra info because if we do not it will not subtract from total shown on paypal Go to Virtuemart administration then Store -> List Payment Methods -> Paypal Click Configuration Tab replace $discount_total = $db->f("coupon_discount") + $db->f("order_discount"); with $discount_total = $db->f("coupon_discount") + $db->f("order_discount") + $db->f("quantity_discount"); OR See the screen shot below and add the highlighted code the same way it looks Step 8 (Global Configuration)Open virtuemart global configuration and Save or Apply it once to generate a new control for quantity discount shown below
After saving the configuration file once without any changes you should be able to see the above highlighted control to enable and disable quantity discounts. Step 9 (Enjoy)Go to site frond end and add something to your shopping cart You will see a new Label below subtotal with quantity Discount as shown below
![]() p.s. If you add any improvements to this module please send it to me i will upgrade it here and i will submit it to virtuemart as well Plus if you want to request any feature you can do so in the comments, The up coming features are
Set as favorite
Bookmark
Email this
Hits: 7119 Comments (40)
![]() written by movies-u, May 15, 2009
hey everything works fantastic..the only problem I have is that i cant work it with Colombian Pesos (COP)
written by a guest, May 15, 2009 hey everything works fantastic..the only problem I have is that i cant work it with Colombian Pesos (COP)it is not showing currency symbol or something else? written by Iain, June 08, 2009
Hi there - great module. I notice though that the tax is calculating on the original pre discount amount - not the post discount amount. how can I fix that - or have I missed a file somewhere in installing this.
Cheers, Iain written by rob, June 15, 2009
Hi,
Two questions, Is it possible to give a group of products a quantity discount? So for instance the second shirt half price? Question 2 Is it possible to give the discount to the cheapest product in range? written by binaryworld, June 17, 2009
No sorry its not possible in the current version , I have a couple of requests i have noted down , i will try to make it possible plus if some one can take the code and improve it and send it back i will contribute this to virtuemart development including the contributors name and website
written by alesiam, June 17, 2009
So, I am not a programmer. I know only HTML and I used to know more CSS, but that's it! I'm learning to navigate this whole Joomla!/CMS thing and I don't know PHP or Sql or anything, so some things in this tutorial are not basic enough for me. For example, in step 3, how do I unzip the files in my Joomla root directory? Is this something other than just doing an install/uninstall in my extensions manager? Also, I have no idea how to do step 4. Finally, will step 5 be obvious as to how and where to create the functions, or will a baby beginner like me need to know more?
Help? Please? written by binaryworld, June 25, 2009
Hi Baby Beginner, This is virtuemart hacking, You must have knowledge about applying hacks to virtuemart before doing this,
Before doing anything always take the backup, Or setup a test site to play around... written by bob, July 05, 2009
Can anyone give a bit more decsription for #4? Import the sql file how?
As for the other guys question as to what the joomla root directory is... its the top level directory that has all your joomla folders it in... administrator, templates, components etc. Thanks! written by bobII, July 05, 2009
I installed the extension... but it appears to only let me add discounts for quantity purchases...
buy 5 get $20 off... or 20% off I have multiple items that have multiple prices... so when the combined price reaches say $25.25 a 5% discount is applied... is that possible to do with this extension? Thanks written by bobII, July 06, 2009
any chance you can expand or point me in the right direction in "applying such discounts on payment methods"?
written by Clark, July 09, 2009
this works very well, put i have just discovered when paying with paypal the discount does not transfer to the paypal website. anyone know how to fix this? Thanks
written by Clark, July 09, 2009
been doing some research on the virtuemart forum and I',m guessing its something to do with the payment extra info script at List Payment Methods >> PayPal >> Configuration tab. I don't know php so cant see what to or wrong.
written by Clark, July 09, 2009
thanks for taking the time to look at this. I am having a problem with the databas import. When I try to import database.sql using phpMyAdmin i get this error:
Error SQL query: ALTER TABLE `jos_vm_orders` ADD `quantity_discount` DECIMAL( 12, 2 ) NOT NULL AFTER `order_shipping_tax` ; MySQL said: Documentation #1060 - Duplicate column name 'quantity_discount' written by richie, July 16, 2009
Hi... guess am still stuck at step 4...
according to this : you can find some good components here for database management http://extensions.joomla.org/e...management I have install the easySQL component and couldn't find any english guide/tutorial on how to use it. So I have 2 questions here "( 1) How do I use the database.sql or where should I copy it to? any directory? 2) As of this statement : "Please Change Database prefix from jos_ to your own database prefix." Any example of own database prefix? thanks. Pardon for the newbie/noob questions. I do need this option in my website but have no knowledge of PHP/SQL... greatly appreciate your kind effort to explain step 4 more precisely. Cheers
written by richie, July 16, 2009
I wonder "The new pane with title Discount" could appear if I skip step 4... is it a compulsory for step4 even am not performing any upgrade?
Cheers written by Andrew, August 03, 2009
Hi there. Just a couple of questions before I try and install.
First, will this run on an old VM 1.0.15 site? And will existing discounts be affected? I have a site I am doing for a winery and I have wine sold as single bottles and as cases of 12 bottles. For the cases I have a 10% discount applied. no problem there, but we also want to offer a 10% discount if they buy 12 single different types of wine bottles. So it will be a mixed case. Will that work? And if they buy a case, which will have 10% discount and then 12 singles which would then take 10% off, would that ignore the discount already applied to the case or take off another 10%? Thanks for your help. written by Andrew, August 07, 2009
Thanks, was going to give it a try but saw that the folders are different, ie I don't have the themes folder, and I'm thinking I'll just bugger it up.
Thanks for your reply though. Andrew written by JT, September 08, 2009
I've run into a problem when trying to do step #4. My DB is MySQL4.0. i'm running Joomla 1.5.10 & VirtueMart 1.1.3 stable.
I ran the sql queries with the file provided (database.sql) and got an error: SQL query: CREATE TABLE IF NOT EXISTS `jos_vm_discount` ( `discount_id` int( 16 ) NOT NULL AUTO_INCREMENT , `products_quantity` int( 11 ) NOT NULL , `amount` float NOT NULL , `percent_or_total` varchar( 32 ) NOT NULL , PRIMARY KEY ( `discount_id` ) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 AUTO_INCREMENT =25 MySQL said: Documentation #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=utf8 AUTO_INCREMENT=25' at line 7 written by Andrew Scott, October 02, 2009
Hi Bob(?),
thanks for a great module. Supposing one customer wishes to order 50 items, another 27, a third 156. Do I need to create separate discounts for any and all numbers up to however high I expect someone to order? Is there a way to set up your module to group discounts as follows, eg 2- 4 copies – 15% 5 - 9 copies – 25% 10 + copies – 45% regards, andy
written by Jesper Bo Larsen, January 18, 2010
Hi
Thanks for a great module. I just installed and everything works perfect, I have only one problem. When the user buy 1 or 2 product and get not discount, I get this message in the basket: Warning: number_format() expects parameter 1 to be double, string given in C:UsersJBLXamppxampphtdocsCreeto3administratorcomponent scom_virtuemartclassescurrencyclass_currency_display.php on line 107 If they buy 3 product and get a discount there is no problems. Could you please help me solve this problem? Best regards Jesper written by Jesper Bo Larsen, January 20, 2010
Hi
Thank you for your answer. In one of the first post someone asked how to update tax after discount. Did you solve this problem? Best regards Jesper written by Jacob F, January 28, 2010
HI, which versions of Joomla and Virtuemart, does this script run with.
written by Kevin Medri, June 24, 2010
Hi have you added the to dos yet, especially the category discount option
Thank you. written by CyberVisionMedia, June 28, 2010
is it possible for the module to work with the TOTAL instead of the QUANTITY of items purchased?
written by dhriendra rathod, July 16, 2010
Is it possible to give the discount to the cheapest product in range?
written by dhriendra rathod, July 16, 2010
1- 5 product– 15%,6 - 10 product –30%,10 >product – 60%
regards, Dhriendra Write comment
|