How To Allow Sub Products To Also Apply for Quantity Discount If Parent Products Category Id Is In Quantity Discount Table

How To Allow Sub Products To Also Apply for Quantity Discount If Parent Products Category Id Is In Quantity Discount Table

If you are using V8 or below versions, you can try this trick.

This helpnote will apply for the following case:

1) You setup a parent and sub products with each have different categories.
Parent product assigned to a category id x.
A sub product assigned to a different category id y.
Another sub product assigned to a different category id z.

2) You setup a Quantity Discount for the parent product category id x to get discount 10% for certain quantity.

3) During checkout, your customers add sub products of the parent products to cart for certain quantity and customers are NOT getting the discount.

You may ask why did this happen.

In V8 and below versions, VPCart only will look at each sub products category assigned and match with the Quantity discount table setup for the category id.
So if customers add a sub product to cart, VPCart will look if the sub product category id eg y or z is inside the Quantiy Discount table setup.
In our example, only parent product category id x is setup for discount. That means any sub products will never get the discount since they have different category with their parent product cat id and only parent product cat id is added to the Quantity Discount table.

In our new version V9, we already use Products Variants so this issue is no longer exist.
All sub products will apply to the same category as the parent so the sub products will also have the qty discount if the parent product category id is added into the Quantity Discount table.

For solution in your V8 or below versions, you will need to edit each of the sub products to also have the same category as the parent product.
However, if you have a lot of sub products to edit, then this will take your time.

You can try this trick with a simple code modification to your V8 file as below:

1) Open file shopuserprice.asp using notepad or text editor.

2) Inside the sub QuantityMatchSubCategories, just BEFORE the code if categories = "" then

Please add this new code:

dim dischigherCatalogId
dim disparentrs
dim disparentsql

'get parent product id
disparentsql = "SELECT higherCatalogId from products where catalogid=" & CatalogId
Set disparentrs = Server.CreateObject("ADODB.Recordset")
disparentrs.open disparentsql, dbc, adOpenStatic, adLockReadOnly

dischigherCatalogId = disparentrs("higherCatalogId")
CloseRecordSet lookuprs

if dischigherCatalogId <> "" then
'get parent cat id
dim discparentcatid
dim discparentcatrs
dim discparentcatsql

discparentcatsql = "SELECT intcategoryid from prodcategories where intCatalogId=" & dischigherCatalogId
Set discparentcatrs = Server.CreateObject("ADODB.Recordset")

discparentcatrs.open discparentcatsql, dbc, adOpenStatic, adLockReadOnly

do while not discparentcatrs.eof
if categories<>"" then
categories = categories & ","
end if

categories = categories & discparentcatrs("intcategoryid")
discparentcatrs.movenext
loop
CloseRecordSet discparentcatrs
end if

3) Save and upload back to your site.

If you have any issues with this you can submit a helpdesk ticket to us at:
https://helpdesk.vpcart.com




Times Viewed:
1299
Added By:
Wilson Keneshiro
Date Created:
9/14/2018
Last Updated:
9/14/2018