Copy link to clipboard
Copied
I am using Adobe business catalyst as Admin control for my shopping cart and I want to put a deal in groupon of my products, where in the customer can buy the deal from groupon and use that discount code that he gets while shopping at my site. So my question is I need to create discount codes for each buy made at groupon of my deal. If say 500 users have bought the deal than I have to create 500 unique discount codes. Can this be done programmatically. If so can anyone explain me how? If not what would be the best way to do this apart from manually entering 500 disocunt codes.
Thank You
Sandy
Why not? Take a look at this tutorial - http://wiki.imacros.net/Demo-Loop-Csv-2-Web - that bacically loops through a .csv, copies the values there, pastes them into a webform and submits them.
I am thinking something similar could work for mass importing discount codes too. Of course targeting the various elements of the admin console is more trickyer than filling and submitting a form but in theory it should work, what do you say?
Copy link to clipboard
Copied
Hi Sandy,
The only way to create discount codes is by manually entering them into site admin. There's unfortunately no other way to do it at this stage.
Regards,
-mario
Copy link to clipboard
Copied
Can back this up, tried a variety of scripts but the BC stuff breaks it.
Only thing you can do is do a peace of content that shows if some conditions based on what is in the cart is matched and shows some text that says "You qualify for a discount, enter xxxx to in the discount area to enter it".
Copy link to clipboard
Copied
Have you used iMacros? It is a free FireFox extension - http://wiki.imacros.net/iMacros_for_Firefox
I used it successfully for working with certain areas of the BC console (cases and forums) and the Partner Portal. Not sure it will work for discount codes but it might be worth a shot.
Copy link to clipboard
Copied
That is not viable for a working website.
Copy link to clipboard
Copied
Why not? Take a look at this tutorial - http://wiki.imacros.net/Demo-Loop-Csv-2-Web - that bacically loops through a .csv, copies the values there, pastes them into a webform and submits them.
I am thinking something similar could work for mass importing discount codes too. Of course targeting the various elements of the admin console is more trickyer than filling and submitting a form but in theory it should work, what do you say?
Copy link to clipboard
Copied
Well I think the biggest problem would be that not everyone uses Firefox?
Copy link to clipboard
Copied
Or even understands plugins, as well as a few things. Mihai, I think the 4 things wrong with this should be obvious I will be worried if they not
Copy link to clipboard
Copied
Thanks to all for the responses, problem solved. Kudos to Mihai Tica, your idea worked perfectly....It reduced me a lot of manual work. I am pasting my macro as a reference to others.....
VERSION BUILD=7401110 RECORDER=FX
TAB T=1
CMDLINE !DATASOURCE C:\\YourFilePath\\Book1.csv
'Number of columns in the csv file:
SET !DATASOURCE_COLUMNS 2
'Increase the current position in the line
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=http://www.YourSitename.com/Admin/Catalogues_DiscountCodes.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_txtdescription CONTENT=samle{{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_txtdiscountCode CONTENT=dd1{{!COL2}}
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_cp_radioTypeFixed
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_txtDiscountPercentage CONTENT=10
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_txtDiscountAmountThreshold CONTENT=26
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_txtXUses CONTENT=1
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_chkCatalogues CONTENT=YES
TAG POS=1 TYPE=SELECT FORM=NAME:aspnetForm ATTR=ID:ctl00_cp_listCatalogues CONTENT=%248268
TAG POS=1 TYPE=DIV ATTR=ID:ctl00_cp_panelCatalogues
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_cp_btnUpdate
Thanks again to all and Mihai Tica 🙂
Copy link to clipboard
Copied
Hey! Could you write me an example of this? its just what I am looking to do!
-Haley
Copy link to clipboard
Copied
@Hales2112,
Sorry I didn't your message earlier. I had to write a tutorial on how to import Discount Codes for one of my clients who does this all the time, and it has a complete example and explanation of how to automatically read in discount codes from a CSV file and have iMacros fill that into the BC Admin form. Link to my blog: How To Import Discount Codes
SandySandeep's script above is a very good start, but there is now some code missing from that which is essential to get BC to do this more realiably in the current BC version. Namely...
1) BC renders the discount form within an iframe so your script has to deal with that iframe, as my tutorial shows
2) Unless you put Wait commands in the script to slow down form submission, BC's server won't keep up with the script and will throw errors. Even with the wait commands, BC still may drop a few discount codes when you are importing 500, and I explain how to deal with that.
How To Import Discount Codes has a complete iMacro script you can copy, and it also shows how to populate the fields so the Discount Code is limited to certain BC catalogues and how to set the effective and expiry dates for the discount.
I have used iMacros for a long time to not only import data into BC Admin that BC normally can't import, but also to populate forms on the public front ends of websites when there is no way in BC to import it.
iMacros is also handy to read data off existing websites and save it into a data file, so you can import it into BC. It's pretty cool considering it is free. I use the FireFox add-on and haven't tried the IE or Chrome version yet, so can't vouch if they work as well.
Jonathan at AtlantaWebDesignGA.com