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

    Default Duplicate product + attribute prevention

    I want to be able to prevent the insertion of duplicate entries base on two id's into the shopping cart. I believe I have to correct code, but am unable to figure out where to put it to prevent the insertion.

    Any help would be appreciated.

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Duplicate product + attribute prevention

    You want to be looking at the routine used for adding products to the cart. You can eitehr look in includes/main_cart_actions.php, or the shopping_cart.php class file. Finally, you can also look at the header_php.php files for either the checkout process, or the shopping cart page, and add additional checks here as well.

    Absolute

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

    Default Re: Duplicate product + attribute prevention

    Thanks for the reply! Yep. Tried that. Doesn't seem to work. Even if I put the code in both files, I get nothing. Below is my code:

    PHP Code:
    // Check for duplicates  
    $check_duplicate "select * from " TABLE_CUSTOMERS_BASKET "
                                             where products_id ='" 
    . (int)$_POST['$products_id'] . "'
                                             and applicants_id = '" 
    . (int)$_POST['$applicants_id'] . "'";
                                             
    $more_than_one=$db->Execute($check_duplicate);

            if (
    $more_than_one->RecordCount() > 0) {
    // Do not add duplicates give a warning          
            
    $dup_uniqueFailed = new messageStack("you have more than one!");
            return 
    $dup_uniqueFailed;
            } else {
    //Process normally


  4. #4
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Duplicate product + attribute prevention

    Both odf your POST variables include $ within the string names, however, they are enclosed in single quotes. If you are actually using variables here, you don't need the '', however, if the post variables are actually called applicants_id and products_id - remove the $.

    You may want to test this by inserting an echo directly after the SQL query has been created, and making sure the SQL looks correct, with all the right values.

    Absolute
    Back, after a 4 year absence! Did you miss me?
    Absolute Web Solutions Ltd
    Interested in our work? Take a look at one of our sites - The Tech Store

 

 

Similar Threads

  1. v139h Update Attribute on All Product, Without Messing up with other attribute in product?
    By vilvas in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 11 Sep 2012, 12:38 AM
  2. I need to duplicate Text Attribute
    By canihave in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 27 Feb 2009, 04:36 PM
  3. Duplicate attribute error?
    By juststartingout in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 21 May 2008, 01:53 AM

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