Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Disable Specific Product from Customers who bought/selected also purchased...

    Is there a way to disable a specific product from being listed in the
    Customers who bought this item also purchased...
    (product info)

    and the
    Customers who selected the items in your cart also chose...
    (shopping cart)

    without disabling the feature compeletly for other products?

    The product I am trying to disable is a Document Product but can be checked out, all my other products are Product General.

  2. #2
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    still have this issue....what is the db table that effects Customers who bought/selected also purchased?

    can I simply go in (phpmyadmin) and delete a specific product #? to edit the Customers who bought/selected also purchased selection?

    I have one product that I do not wish to appear in Customers who bought also purchased sections.
    Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

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

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    This would not show products_id 12 in the Also Purchased:
    Code:
    <?php
    /**
     * also_purchased_products.php
     *
     * @package modules
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: also_purchased_products.php 5369 2006-12-23 10:55:52Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    if (isset($_GET['products_id']) && SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS > 0 && MIN_DISPLAY_ALSO_PURCHASED > 0) {
    
      $also_purchased_products = $db->Execute(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id']));
    
      $num_products_ordered = $also_purchased_products->RecordCount();
    
      $row = 0;
      $col = 0;
      $list_box_contents = array();
      $title = '';
    
      $skipped = 0;
      // show only when 1 or more and equal to or greater than minimum set in admin
      if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED && $num_products_ordered > 0) {
        if ($num_products_ordered < SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS) {
          $col_width = floor(100/$num_products_ordered);
        } else {
          $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS);
        }
    
        while (!$also_purchased_products->EOF) {
          if ($also_purchased_products->fields['products_id'] == 12) { // skip 12
            $skipped ++;
            // do nothing
          } else {
          $also_purchased_products->fields['products_name'] = zen_get_products_name($also_purchased_products->fields['products_id']);
          $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsAlsoPurch"' . ' ' . 'style="width:' . $col_width . '%;"',
          'text' => (($also_purchased_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' . $also_purchased_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $also_purchased_products->fields['products_image'], $also_purchased_products->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' . $also_purchased_products->fields['products_id']) . '">' . $also_purchased_products->fields['products_name'] . '</a>');
    
          $col ++;
          if ($col > (SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS - 1)) {
            $col = 0;
            $row ++;
          }
          } // skip 10
          $also_purchased_products->MoveNext();
        }
      }
      if ($also_purchased_products->RecordCount() - $skipped > 0 && ($also_purchased_products->RecordCount() - $skipped) >= MIN_DISPLAY_ALSO_PURCHASED) {
        $title = '<h2 class="centerBoxHeading">' . TEXT_ALSO_PURCHASED_PRODUCTS . '</h2>';
        $zc_show_also_purchased = true;
      }
    }
    ?>
    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: v1.5.5]
    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!

  4. #4
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    Hi Linda! Merry Xmas!

    Thanks for your post/code! It works with a few edits, the product_12 does not appear on the product info page, but still appears in the shopping cart "Customers who selected the items in your cart also chose..."

    is there a way to get rid of that also?

    here's the code you gave me/I edited slightly aka
    $skipped = 0;
    changed to
    $skipped = 12;
    PHP Code:
    <?php
    /**
     * also_purchased_products.php
     *
     * @package modules
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: also_purchased_products.php 5369 2006-12-23 10:55:52Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    if (isset(
    $_GET['products_id']) && SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS && MIN_DISPLAY_ALSO_PURCHASED 0) {

      
    $also_purchased_products $db->Execute(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id']));

      
    $num_products_ordered $also_purchased_products->RecordCount();

      
    $row 0;
      
    $col 0;
      
    $list_box_contents = array();
      
    $title '';

      
    $skipped 12;
      
    // show only when 1 or more and equal to or greater than minimum set in admin
      
    if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED && $num_products_ordered 0) {
        if (
    $num_products_ordered SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS) {
          
    $col_width floor(100/$num_products_ordered);
        } else {
          
    $col_width floor(100/SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS);
        }

        while (!
    $also_purchased_products->EOF) {
          if (
    $also_purchased_products->fields['products_id'] == 12) { // skip 12
            
    $skipped ++;
            
    // do nothing
          
    } else {
          
    $also_purchased_products->fields['products_name'] = zen_get_products_name($also_purchased_products->fields['products_id']);
          
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsAlsoPurch"' ' ' 'style="width:' $col_width '%;"',
          
    'text' => (($also_purchased_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' $also_purchased_products->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $also_purchased_products->fields['products_image'], $also_purchased_products->fields['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT) . '</a><br />') . '<a href="' zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' $also_purchased_products->fields['products_id']) . '">' $also_purchased_products->fields['products_name'] . '</a>');

          
    $col ++;
          if (
    $col > (SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS 1)) {
            
    $col 0;
            
    $row ++;
          }
          } 
    // skip 12
          
    $also_purchased_products->MoveNext();
        }
      }
      if (
    $also_purchased_products->RecordCount() - $skipped 12 && ($also_purchased_products->RecordCount() - $skipped) >= MIN_DISPLAY_ALSO_PURCHASED) {
        
    $title '<h2 class="centerBoxHeading">' TEXT_ALSO_PURCHASED_PRODUCTS '</h2>';
        
    $zc_show_also_purchased true;
      }
    }
    ?>
    Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

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

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    This line needs to be 0:
    Code:
      $skipped = 12;
    This line needs to use 0:
    Code:
     if ($also_purchased_products->RecordCount() - $skipped > 12 && ($also_purchased_products->RecordCount() - $skipped) >= MIN_DISPLAY_ALSO_PURCHASED) {
    $skipped is a counter ... not a products_id ...

    The only thing you needed to change was the line:
    Code:
          if ($also_purchased_products->fields['products_id'] == 12) { // skip 12
    That is the products_id being tested ... everything else is to offset the counters for if this product is in the SELECT statement so things count correctly with 1 less on the counts ...
    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: v1.5.5]
    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!

  6. #6
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    Hmmmm... didn't work the first time around, thats why I added the 12....funny it worked with my crazy edits

    I replaced the 12s with 0 as it should be.....now it works(yay), I do not see product_12 on product info page, but still seeing product_12 in shopping cart: "Customers who selected the items in your cart also chose..."

    is there another edit/or file to get rid of this also?
    Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

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

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    You might have an add on for the shopping cart ... that is not part of Zen 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: v1.5.5]
    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!

  8. #8
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Disable Specific Product from Customers who bought/selected also purchased...

    whoops! using old upsell mod on cart page.....I forgot it was a mod sorry

    Thanks again for your help!

    other ZC folk remember to make this an override file
    Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

 

 

Similar Threads

  1. Customers who bought this product also purchased...
    By 1speedbump in forum General Questions
    Replies: 4
    Last Post: 23 Jan 2014, 06:03 PM
  2. Customers who bought this product also purchased...
    By explorer1979 in forum Templates, Stylesheets, Page Layout
    Replies: 33
    Last Post: 8 Nov 2011, 10:00 PM
  3. Customers who bought this product also purchased...
    By redsky in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 May 2009, 07:53 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR