Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: Automatically delete products...

    I've had a quick look at the code. Is it correct that I should only need to use the following?

    Code:
        // remove product from all its categories:
        for ($k=0, $m=sizeof($product_categories); $k<$m; $k++) {
          $db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . "
                        where products_id = '" . (int)$product_id . "'
                        and categories_id = '" . (int)$product_categories[$k] . "'");
        }
        // confirm that product is no longer linked to any categories
        $count_categories = $db->Execute("select count(categories_id) as total
                                          from " . TABLE_PRODUCTS_TO_CATEGORIES . "
                                          where products_id = '" . (int)$product_id . "'");
        // echo 'count of category links for this product=' . $count_categories->fields['total'] . '<br />';
    
        // if not linked to any categories, do delete:
        if ($count_categories->fields['total'] == '0') {
          zen_remove_product($product_id, $delete_linked);
        }

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Automatically delete products...

    Without looking at the file again to confirm, I think that's about right.
    .

    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.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 5 Feb 2013, 10:08 AM
  2. v150 How to delete manually installed 1.3.8a and automatically install 1.5.0?
    By zenartman in forum Upgrading to 1.5.x
    Replies: 2
    Last Post: 21 Feb 2012, 12:35 AM
  3. Replies: 13
    Last Post: 3 Oct 2011, 02:22 PM
  4. Automatically dispatch certain products?
    By HManney in forum Managing Customers and Orders
    Replies: 0
    Last Post: 26 Jul 2011, 09:23 PM
  5. Can't delete products in cart with delete button
    By DaveS in forum General Questions
    Replies: 4
    Last Post: 20 Sep 2009, 09:54 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