Forums / Addon Shipping Modules / Trying to add extra data to look up from shipping module

Trying to add extra data to look up from shipping module

Started by heyits007 on 16 May 2011, 4:45 PM · Views: 1,990

Results 1 to 15 of 15
16 May 2011, 4:45 PM
#1
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Trying to add extra data to look up from shipping module

Does anyone know what PHP file adds the items to the shopping cart ?

Thanks,
007

16 May 2011, 5:30 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,692
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

What are you wanting to do?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

17 May 2011, 6:36 PM
#3
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

I want to see how the items are added to the shopping cart in PHP. I want to add extra data. i.e. manufacturers_id so I can access it in the shipping module and then look up the manufacturers table using it as the key.

Thanks,
007

17 May 2011, 8:58 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: Trying to add extra data to look up from shipping module

You can look up a product's manufacturer's id in your shipping module - no need to change the add to cart behavior. The function zen_get_products_manufacturers_id($prid) will get the manufacturer for product id $prid.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

18 May 2011, 4:59 PM
#5
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

Hey that function zen_get_products_manufacturers_id($prid) to get the manufacturer for product id $prid actually worked.

Thanks for that. One more step along the long and winding road.

Having solved that problem, I now want to be able to query the manufacturers table using that **manufacturers_id ** as the key.

I need a custom query to do this, as I have added an extra field called Man_PostCode in the manufacturers table that I want to extract into a variable. Thus I don't think any standard function will exist to extract that. Any ideas on how to do that ?

Thanks.

Thanks,
007

18 May 2011, 5:02 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: Trying to add extra data to look up from shipping module

The directory includes/functions/extra_functions exists so you can add custom functions like the one you're describing. Use the function I pointed you to as a model for your new function.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

18 May 2011, 5:09 PM
#7
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

OK Thanks. I will give it a try.

Thanks,
007

19 May 2011, 5:29 PM
#8
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

I don't really know PHP very well. So what PHP file name do I put this extra function in and how do I inlcude it to be called from the shipping module ?

i.e. in directory includes/functions/extra_functions

Thanks,
007

19 May 2011, 6:04 PM
#9
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

I've got it working, but in the main functions module until I can work out how to apply it in the extra_functions directory. Apart from that, its working.

Thanks,
007

19 May 2011, 9:15 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Trying to add extra data to look up from shipping module

The filename for files in the /extra_functions/ folder is irrelevant; it only serves to be able to locate the right file if you want to edit it. All files there are autoloaded.

20 May 2011, 3:02 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Trying to add extra data to look up from shipping module

If the custom coding you've done directly modifies an existing function, then you have to edit the original file.
The extra_functions folder is only for NEW functions you add for your own purposes.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 May 2011, 2:00 PM
#12
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

OK thanks. One problem I have noticed is that these SQL query functions I added, only work when the user is logged in.

When someone estimates shipping without being logged in, my custom SQL query lookups fail.

Thanks,
007

20 May 2011, 8:22 PM
#13
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

OK I will make a correction to the above. The SQL queries are actually working OK without being logged in. The problem lies elsewhere. i.e. I'm getting a null Product ID when not logged in and this if effecting the lookup of the Manufacturers_id.

I discovered this by assigning a test data value to $ProdID without being logged in and it then looked up the manufacturers_id OK. The quesiton is why it's null when not logged in. I'ts a coding issue I think. I will sleep on it.

Thanks,
007

20 May 2011, 8:39 PM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Trying to add extra data to look up from shipping module

We would have to see what code you have now to advise on how to correct the issue you are having...

20 May 2011, 9:13 PM
#15
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: Trying to add extra data to look up from shipping module

Thanks. I just worked it out. I wasn't using the session data when the user was not logged in. i.e. I was still trying to use the order data for the user account when not logged in. Using the session data seemed to fix this.

Thanks,
007