If this is your first visit, check our documentation. To post, register or login.
Forums / Strategies for Advertising my Online Store / Coupon code embedded in the web address?

Coupon code embedded in the web address?

Locked

Started by georgeh on 15 Oct 2012, 7:44 AM · Views: 71

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
15 Oct 2012, 7:44 AM
#1
georgeh avatar

georgeh

New Zenner

Join Date:
Oct 2012
Posts:
2
Plugin Contributions:
0

Coupon code embedded in the web address?

Hi Everyone,

Is there a way to have a coupon embedded in the web address so when someone goes to that web address, the coupon is automatically applied? For instance, a weblink like

http://opushealthsolutions.com/cart/index.php?coupon=FREEMETER

and the coupon FREEMETER is automatically applied in the shopping cart?

I want to use coupon codes to track lead sources, and so this can simplify what our salesmen give out to their clients.

Thanks.

George

15 Oct 2012, 12:07 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Coupon code embedded in the web address?

georgeh:

Is there a way to have a coupon embedded in the web address so when someone goes to that web address,the coupon is automatically applied? For instance, a weblink like

http://opushealthsolutions.com/cart/index.php?coupon=FREEMETER

and the coupon FREEMETER is automatically applied in the shopping cart?

Yes, there is a way to do what you are asking, but if I told you how to do it you will almost be assured of creating more problems than you could ever hope to solve. The reason being is because your question indicates that you don't have any real idea as to how websites actually work.

For example, you state you want this "when someone goes to that web address". This brings up two questions:

  1. Exactly what do you mean by "goes to"? There are several ways a person can 'go to' a website? They can go via a bookmark, they can go to it via a link from a search engine, or they can go to it by typing the URL into their browser. On this basis alone you'll should realize that you can't actually 'embed' something into the URL if (for example) the user is typing it in.

  2. You state "that web address" without any consideration as to what the address is that you are actually thinking of. For instance take:
    http://opushealthsolutions.com

    http://opushealthsolutions.com/cart/
    http://opushealthsolutions.com/cart/index.php

Which one of these are you referring to as 'that web address'? These all all 'web addresses', but obviously they are not all THE SAME address. So do you want/need this 'embedding' to occur with all of these addresses or just one of them?
What if the customer follows a weblink to a particular store item, this will be yet another 'web address'. Should the code also be embedded in this type of link?

OK, so now that I've put forth these things that must all be taken into consideration, the solution to the problem is with judicious use of mod_rewrite (via the .htaccess method). This is the only solution that can have any hope of working because it works server side rather than client side (thus making Q1 moot)

The main problem you'll have to contend will relate to Q2, because you'll need to be careful to ensure that any rewrite rules you create will only be applied when and where needed, and they must be written so they don't conflict with normal zencart behaviour. Not an easy task.

Finally, even if you do get the mod_rewrites working to your requirements, you'll then have to take a look at the zencart code itself do that it knows what to do when it comes across this 'embeded coupon', otherwise it'll probably just 'die' with a syntax error or undefined variable error, or something equally unexpected.

As I say, it CAN be done, but whether it SHOULD be done is another matter, and whether you are capable of doing it is pretty much a foregone conclusion ) no, you are not).
I don't mean any disrespect with this last comment... I'm not suggesting that you are unable to obtain the knowledge required, but at this stage of the game, the very question asked is evidence enough that this is considerably beyond your current level of understanding.

Hopefully I haven't offended you.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

25 Oct 2012, 3:32 PM
#3
georgeh avatar

georgeh

New Zenner

Join Date:
Oct 2012
Posts:
2
Plugin Contributions:
0

Re: Coupon code embedded in the web address?

Hi Rod,

No you did not offend me. I've learned a long time ago that you can't eat pride for dinner... It's better to ask dumb questions so you don't end up doing dumb things.

Here's what I was trying to do. We will have salesmen making sales, and it'd be good if they just give up a simply link like
http://opushealthsolutions.com/12345 or
http://12345.opushealthsolutions.com/

which my hosting company can turn into something like
http://opushealthsolutions.com/cart/.....coupon=FREEMETER

which in tern will prompt the system to insert the discount code automatically. That way, the salesman won't have to tell the end-users to put in a certain discount code at check-out...

George