Forums / General Questions / altering basket contents

altering basket contents

Locked

Views: 1,509

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
27 Nov 2009, 8:52 PM
#1
nagelkruid avatar

nagelkruid

Zen Follower

Join Date:
Nov 2006
Posts:
284
Plugin Contributions:
0

altering basket contents

i noticed the products_id in the customers_basket tables can either be stored as the real products_id say 123 or as 123:a2345erttetcetera.
What i make from it, probably zen_id's get stored along with the products_id into this products_id field when someone is logged in as opposed to someone not being logged in?

Is there a reason for that behaviour, is it expected?
I would prefer just the products_id would be listed and not the extended string so i can do normal searches on this column based on the products_id.

Thanks,
Jeroen

27 Nov 2009, 9:12 PM
#2
Kim avatar

Kim

Obaa-san

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

Re: altering basket contents

The "long string" is the product's attributes in a hash code. So you can't just "not have it":

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.

27 Nov 2009, 9:17 PM
#3
nagelkruid avatar

nagelkruid

Zen Follower

Join Date:
Nov 2006
Posts:
284
Plugin Contributions:
0

Re: altering basket contents

Kim:

The "long string" is the product's attributes in a hash code. So you can't just "not have it":
Ah, i see, thanks

30 Nov 2009, 12:32 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: altering basket contents

This is just a trick to convert the products_id from a products_id with a prid to just the products_id ...

Try this in phpMyAdmin ... there are better ways but this is a quick method I have used when I forget other ways ... :smile:
SELECT customers_basket_id, customers_id, products_id, customers_basket_quantity, final_price, customers_basket_date_added, products_id*1 as prod_id FROM customers_basket WHERE 1```


The prod_id will be created with the products_id without the prid attached ...

To do a search on a products_id without the prid, you could search using the Like %...% with **133:** to find products_id **133** ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Nov 2009, 8:57 AM
#5
nagelkruid avatar

nagelkruid

Zen Follower

Join Date:
Nov 2006
Posts:
284
Plugin Contributions:
0

Re: altering basket contents

Ajeh:

This is just a trick to convert the products_id from a products_id with a prid to just the products_id ...

Try this in phpMyAdmin ... there are better ways but this is a quick method I have used when I forget other ways ... :smile:
SELECT customers_basket_id, customers_id, products_id, customers_basket_quantity, final_price, customers_basket_date_added, products_id*1 as prod_id FROM customers_basket WHERE 1
Hello Linda,
I really like it, works great, although i can't get my head around the logic behind it :smartalec: The column is tiny text field so if you multiply it by 1 it will disregard anything behind the : because it thinks this is some sort of decimal value...

Mmm, probably not, but i never understand how those magicians out there get the rabbits out of their hat either:laugh:

Nice trick, cheers,
Jeroen

30 Nov 2009, 5:22 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: altering basket contents

One note on the use of the LIKE and the prid in the SQL statement ... you really want LIKE command with just the trailing %, example:

SELECT * FROM customers_basket WHERE products_id LIKE '133:%';

to avoid the issue of getting things like:
133
1133
2133
etc. etc. etc.

from being included in the match ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Jan 2010, 3:30 PM
#7
efpw avatar

efpw

New Zenner

Join Date:
Dec 2009
Posts:
2
Plugin Contributions:
0

Re: altering basket contents

Why is this done with hash code? In zen_orders_products and zen_orders_products_attributes, the orders_products_Id is used to link the two tables to save the attributes for the orders and products with attributes. It seems like a much better way. We already have the zen_customers_basket_attributes table.

Any thoughts?

12 Jan 2010, 4:23 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: altering basket contents

The products_id in the basket is the prid that matches the orders_products table products_prid ...

There isn't a real need to store in the basket both a clean products_id and the prid ...

In the orders tables it is more efficient to have both as more things are done with those tables where having both are a better method ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!