Forums / General Questions / passing parameters from poduct info page to shopping cart.

passing parameters from poduct info page to shopping cart.

Started by gmartakis on 15 Jan 2013, 10:47 AM · Views: 4,383

Results 1 to 12 of 12
15 Jan 2013, 10:47 AM
#1
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

passing parameters from poduct info page to shopping cart.

Hi,
I want to pass some parameters to shopping cart page. More specifically I want to pass productId from product info so the link when it goes to shopping cart changes something like that:

index.php?main_page=shopping_cart&cPath=36_42&products_id=103

instead of

index.php?main_page=shopping_cart

Could you please tell how to accoplish this?
Thank you

15 Jan 2013, 11:21 AM
#2
rodg avatar

rodg

Deceased

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

Re: passing parameters from poduct info page to shopping cart.

gmartakis:

Hi,
I want to pass some parameters to shopping cart page. More specifically I want to pass productId from product info so the link when it goes to shopping cart changes something like that:

index.php?main_page=shopping_cart&cPath=36_42&products_id=103

instead of

index.php?main_page=shopping_cart

Could you please tell how to accoplish this?
Thank you

Sorry, but I'm not quite following what you are trying to do.

Exactly what is the problem that you are trying to solve?

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.

15 Jan 2013, 11:45 AM
#3
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

I'm trying to pass the product id parameter to http://www.domainexample.com/index.php?main_page=shopping_cart in order to do same changes to the cart. I cannot get the Product id with $_GET[products_id]; or with a different way like $_SESSION[products_id];. Therefore I'm trying to find other ways to accomplish that. Could you help me?

15 Jan 2013, 12:36 PM
#4
rodg avatar

rodg

Deceased

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

Re: passing parameters from poduct info page to shopping cart.

gmartakis:

I'm trying to pass the product id parameter to http://www.domainexample.com/index.php?main_page=shopping_cart in order to do same changes to the cart. I cannot get the Product id with $_GET[products_id]; or with a different way like $_SESSION[products_id];. Therefore I'm trying to find other ways to accomplish that. Could you help me?

Apologies. I understand what it is you are asking for, the problem is I don't quite understand exactly why you feel/think there is a need to do this.

Feel free to tell me to mind my own business, or say it isn't important that I know, I don't have an problem with that.

It is simply because this is a very unusual request, that I can't help thinking that there may be another option open to you, something that doesn't require code hacking, and it would be amiss of me to help you down a path to possible further problems if there is no need to do so.

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.

15 Jan 2013, 12:48 PM
#5
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

Hi Rod,
I'm using a module stock by attributes my site is https://www.sellisbike.gr/demo and I would like to display for every option availability you can see my product info http://www.sellisbike.gr/demo/index.php?main_page=product_info&cPath=42&products_id=102 this is how I display my product_info page. I would like to do the same for my shopping cart but I cannot accomplish that if can pass the product id variable to the tpl_shopping_cart_default.php. Simple what I did is to copy a piece of code from the stock by attribute code and transform it the way I want to.

Now what I want from you is to tell me how I could pass product Id variable to shopping_cart page.
Please Reply ASAP.
Regards
Ioannis

15 Jan 2013, 1:14 PM
#6
rodg avatar

rodg

Deceased

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

Re: passing parameters from poduct info page to shopping cart.

gmartakis:

Now what I want from you is to tell me how I could pass product Id variable to shopping_cart page.
Please Reply ASAP.
Regards
Ioannis

I've just taken a very quick look at the variables, etc available on the product_info page and didn't spot anything there that would be useful to you.

I do have another suggestion for you though, since you can't (apparently) pass this value to the shopping cart page, you could modify the shopping_cart page itself and perform a check on the HTTP_REFERER variable, which would read something like
http://yourdomain.com/index.php?main_page=product_info&cPath=42&products_id=102

You can then extract the product_id from the path and use it as needed.

I've no idea what repercussions you may experience as a result of what you are trying to do... For all i know there may not be any. I guess you'll find that out for yourself when the time comes. :)

lemme know if it does work though, because I'm somewhat curious. I really didn't see the point when you 1st asked, but now I've seen your page(s) I see where you are heading.. It could be useful if it works as expected.

The biggest 'problem' I see is that this will only work for the product as it is added to the cart.

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.

15 Jan 2013, 1:31 PM
#7
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

Thanks for the quick prompt Rod,
I will try this....I'm not sure how I'm going to do it. Anyway I have another problem that it's bothering me a lot since I created this site...
I'm trying to display manufacturer filter in product listing. But even if I enable it from the admin panel...the alpha sorter filter is showing what ever I do. I tried to fix it but with no luck.....any suggestions?
Regards
Ioannis

15 Jan 2013, 1:39 PM
#8
rodg avatar

rodg

Deceased

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

Re: passing parameters from poduct info page to shopping cart.

gmartakis:

. I tried to fix it but with no luck.....any suggestions?

Sorry, none at this time.

Cheers
Rod.

ps. It might pay to open a new thread for this question. More people are likely to see it.

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.

15 Jan 2013, 1:39 PM
#9
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

I did print what you said to my tpl_shopping_default.php page echo $_SERVER['HTTP_REFERER'];
it prints the URL of the product_info page....it's good...Well I dont know how to extract this values from this URL any advice would be great my friend...
Regards,
Ioannis

15 Jan 2013, 1:56 PM
#10
gmartakis avatar

gmartakis

New Zenner

Join Date:
Feb 2011
Posts:
73
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

any advice here would be crusial here.
Thanks again
Regards
Ioannis

15 Jan 2013, 1:58 PM
#11
rodg avatar

rodg

Deceased

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

Re: passing parameters from poduct info page to shopping cart.

gmartakis:

Well I dont know how to extract this values from this URL any advice would be great my friend...

There are many different ways to do this. Possibly one of the easiest is to use the PHP 'parse_url' function

You'll find a few examples here:
http://php.net/manual/en/function.parse-url.php

This is my last post for the night. I'm heading off to bed (so if you have other questions, its not because I'm ignoring 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.

3 Jul 2013, 4:06 AM
#12
chamm avatar

chamm

New Zenner

Join Date:
Jul 2013
Location:
United States
Posts:
3
Plugin Contributions:
0

Re: passing parameters from poduct info page to shopping cart.

I would like to pass in a date to the product info page, then on to the shopping cart. I have a calendar of events with a group of products. The group of products will remain the same but I would like to pass in the date that the customer clicks on all the way through to the cart.

Example: The customer clicks on a link for a group event for a certain date. The date parameter is put in to session and passed to the category list page. Then the customer clicks on the specific product to view the product info page with the date from the referring page retained in session. Then the date of the original link is added (hidden) to the product attributes when the item is added to cart.

I'm counting on someone to help me figure this one out. I know of a bit of PHP but haven't done anything with _SESSION yet.

Here's the site so you can view what I've got so far and THANK YOU in advance. http://www.paintingbarn.com

C.