Jump to content

Uploading Product List Type to coupons


Dspooner

Recommended Posts

In what manner will the 'upload' take place?

 

The list of products to include, or the list of products to exclude are run through PHP's serialize() function. The result as seen in the CubeCart_coupon database table is of the format:

a:2:{i:0;s:7:"exclude";i:1;s:1:"1";}

 

That is:

an array with two elements comprising of:

  index 0; string of length 7: "exclude";

  index 1; string of length 1: "1"; (<- the product_id)

 

The other columns in the coupon table are straightforward. (If there is a value in the cart_order_id column, then this is actually a Gift Certificate.)

Link to comment
Share on other sites

"Do I just put these in an Excel file, and were do I upload the file?"

 

Excel can be used to create a CSV file, and while in Excel, the spreadsheet will look like this:

1 | status | code | product_id                           | discount_percent | discount_price | expires    | allowed_uses | min_subtotal | count | shipping | description       |
2 |      1 | ABC1 | a:2:{i:0;s:7:"exclude";i:1;s:1:"1";} |             0.00 |          10.00 | 2014-04-30 |           10 |         0.00 |     0 |        0 | Coupon Named ABC1 |
3 |

As discussed earlier, the serialization of the 'product_id' column needs to have the proper format.

 

Then, the CSV file that Excel will save this spreadsheet as, you can have phpMyAdmin import that file into the CubeCart_coupons table.

 

Link to comment
Share on other sites

In admin, go to Products. View the Product Inventory list. Hover the mouse cursor over the name of a product. Your browser should indicate in some manner the web address the link points to. For example: hllp://www.store.com/admin.php?_g=products&sort%5Bupdated%5D=DESC&action=edit&product_id=3

 

It is the 3 that is the product_id and it would be the 3 that would be in the serialize string: a:2:{i:0;s:7:"exclude";i:1;s:1:"3";}

 

A serialed string that excludes three products would be:

a:4:{i:0;s:7:"exclude";i:1;s:1:"3";i:2;s:1:"7";i:3;s:2:"18";}

meaning, exclude the products where the product_id is 3, 7 and 18. And not that the serialized array now has 4 elements.

 

The SKU being "CC12345" is known to CubeCart as the product's product_code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...