0

We've bunch of shopping cart volume and coupon code discounts for our website. We can't add those discounts each and every time through CS-Cart back-end "Promotions" tab. So, we've made a import script in PHP which imports the records in the DB tables "_promotions AND _promotion_descriptions". Our PHP import script is inserting the records in the DB tables perfectly without any issue and we can see those records on back-end "Promotions" list page. See attached screenshot.

But, when we're adding the items in the shopping cart from front-end then CS-Cart is not applying the volume or coupon code discounts on our website.

Our question is: Does CS-Cart add any reference for the promotions in any other table (including the "_promotions AND _promotion_descriptions" tables) OR create a reference of a new promotion in a "cache", after promotion added from back-end?

It seems like it does, since when we're adding the new volume or coupon code discounts from back-end "Promotions" tab, then those promotions work perfectly without any issue. But, the volume and coupon code discounts doesn't works, when we're adding records manually in the DB table through our PHP import script.

Can any one help us out with this, since we can't find any online help for CS-Cart promotions DB tables.

Thanks.

enter image description here

user2136790
  • 61
  • 1
  • 2
  • 6

3 Answers3

0

CS-Cart uses only these two tables for promotions data:

cscart_promotions

cscart_promotions_descriptions

So, I would recommend you to check the data in DB for the promotions you create using script. If I were you I would create two similar promotions one using CS-Cart backend interface, and another using the script. After that using the function fn_print_r I would print the resulted data of each of these promotions and compared it.

Just add the debug after the functions that gets promotion data in app/controllers/backend/promotions.php, it should look like:

$promotion_data = fn_get_promotion_data($_REQUEST['promotion_id']);
fn_print_r($promotion_data);
0

Also, we did one simple thing which you can do at your own CS-Cart DB. We added a promotion from the back-end and it inserted records in the promotion tables (like specified below):

cscart_promotions table data

promotion_id - auto_increment

company_id (value - "1")

conditions (value - "a:3:{s:3:"set";s:3:"all";s:9:"set_value";s:1:"1";s:10:"conditions";a:2:{i:1;a:3:{s:8:"operator";s:3:"gte";s:9:"condition";s:15:"products_number";s:5:"value";s:3:"500";}i:2;a:3:{s:8:"operator";s:3:"lte";s:9:"condition";s:15:"products_number";s:5:"value";s:3:"999";}}}")

bonuses (value - "a:1:{i:1;a:3:{s:5:"bonus";s:14:"order_discount";s:14:"discount_bonus";s:13:"by_percentage";s:14:"discount_value";s:2:"15";}}")

to_date (value - "0")

from_date (value - "0")

priority (value - "0")

stop (value - "N")

zone (value - "cart")

conditions_hash (value - "products_number=500;products_number=999")

status (value - "A")

number_of_usages (value - "0")

users_conditions_hash (set blank)

cscart_promotion_descriptions table data

promotion_id (same as cscart_promotions.promotion_id)

name (value - "Volume Discount (500 item)")

short_description (set blank)

detailed_description (set blank)

lang_code (value - "en")

When we added the above record from back-end and tried to used that promotion on front-end honestly it worked. Moving forward we just deleted that promotion from back-end and tired to add that promotion manually in the promotions DB tables. It was added perfectly and show us conditions and bonus tabs data perfectly on back-end. See attached screenshot. But, when we're using that manully added promotions on front-end, it doesn't work.

This is wired same record no change shows perfectly on back-end but why not working on front-end. Any suggestions?

Thanks.

enter image description here

Community
  • 1
  • 1
user2136790
  • 61
  • 1
  • 2
  • 6
  • We've found solution for that. After adding the records in the "_promotions" DB tables. We've added the reference record in the DB table "cscart_ult_objects_sharing" and the promotions worked for us on the front-end. – user2136790 Apr 21 '14 at 17:50
0

Beside tables

cscart_promotions
cscart_promotions_descriptions

is required also to insert into table:

cscart_ult_objects_sharing

data

share_company_id = $company_id
share_object_id = $promotion_id
share_object_type = "promotions"
Hungryweb
  • 615
  • 6
  • 11