Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    21
    Plugin Contributions
    0

    Default Product_id changes (string added) when inserted into database?

    I was looking for the code that appends a string at the end of the product_id when inserted into customer_basket and customers_basket_attributes.

    Anyone know where I can find that?

    Thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product_id changes when inserted into database

    When a Product is added to the customers_basket it is added as the products_id ...

    The difference will be if there are attributes where a prid is created, or a reference point, for the product to the attribute(s) of the given product ...

    This allow you to add Product A with products_id 27 and Attribute with Color Red ... and then add Product A with products_id 27 and Attribute with Color Blue ...
    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!

  3. #3
    Join Date
    Nov 2008
    Posts
    21
    Plugin Contributions
    0

    Default Re: Product_id changes when inserted into database

    Thanks for the quick response!

    I'm trying to do something unique as far as I have read in the forums for the last three years, but I'll try and explain clearly.

    I need to have each "product" be unique in my zencart. The snag that I have run into is the system automatically detects if a product with the same product_id-prid is in the database. I have been able to get the system to do what I want by changing the product_id's in the database, and restarting my session. I was wondering if there is an easy way to insert a unique id automatically in the code?

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product_id changes when inserted into database

    Are you saying if I order a Widget in Red ... and then add it a second time to the cart that you do not want it to say quantity 2 but rather have separate records?

    You are kind of losing me here on what it is you are trying to do as the products_id is unique on each product and adding attributes builds a prid to keep them unique based on product/attribute combination as they are added to the cart ...
    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!

  5. #5
    Join Date
    Nov 2008
    Posts
    21
    Plugin Contributions
    0

    Default Re: Product_id changes (string added) when inserted into database?

    I know its a little confusing.......my products and attributes can be duplicated, but I have another "attribute" that is custom to each customer. This custom attribute in combination with product and global attribute cannot be duplicated. Needless to say I have custom coded a lot for this to happen in zencart.

    Your previous explanation has lead me to a possible solution

    I have added a microtime() to the prid md5 id that is created when inserted into the database.

    Can you foresee any major problems with this solution?

    Thanks again for the quick responses!

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product_id changes (string added) when inserted into database?

    If you use the products_id field and add on to the prid and it keeps things tracked together it should work ...

    Otherwise, you will want to use a seperate field for your code so that it doesn't conflict with product tracking etc.
    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!

 

 

Similar Threads

  1. My hazmat one-time fee is not being factored into price when added to cart
    By tcarden in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 31 Jan 2013, 07:21 PM
  2. Need help...Sale price changes when added to cart
    By klhess in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 24 Oct 2010, 04:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg