Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    272
    Plugin Contributions
    0

    Default Exclude a category from new products migration

    Hi,

    I wish to exclude a category from new products migration so that new entries in that category do not show up in "new products".

    Can this be done - any help appreciated.

    cheers,
    Mike

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,883
    Plugin Contributions
    6

    Default Re: Exclude a category from new products migration

    You need to edit the SELECT statements on any thing you do not want a specific master_categories_id to show up on ...

    Add to the WHERE statement:
    and p.master_categories_id != xx

    where XX is the categories_id you do not want added ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    272
    Plugin Contributions
    0

    Default Re: Exclude a category from new products migration

    Quote Originally Posted by Ajeh View Post
    You need to edit the SELECT statements on any thing you do not want a specific master_categories_id to show up on ...

    Add to the WHERE statement:
    and p.master_categories_id != xx

    where XX is the categories_id you do not want added ...
    Many Thanks Linda - where will I find this "SELECT" data - is it in Categories.php or elsewhere?

    cheers,
    Mike

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,883
    Plugin Contributions
    6

    Default Re: Exclude a category from new products migration

    If you want to control the New Products then it would be in the module or sidebox or listing for New Products ...

    /includes/modules/pages/products_new/header_php.php
    /includes/modules/sideboxes/whats_new.php
    /includes/modules/new_products.php

    be sure to use your templates and overrides for any changes that you make ...

    NOTE: the header file does not have a templates and overrides for it ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  5. #5
    Join Date
    Jul 2006
    Location
    Washington State
    Posts
    77
    Plugin Contributions
    0

    help question Re: Exclude a category from new products migration

    Have been trying this code in various files in Zencart 1.5 and it is not doing anything.

    In header_php.php in products_new folder have noticed code now reads:

    WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $display_limit . $order_by;

    No $order_by in earlier versions. This code is in the other files also.

    Tried: #1

    WHERE p.products_status = 1
    AND p.master_categories_id != 7
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $display_limit . $order_by;

    Does not work.
    Tried: #2

    WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $display_limit . $order_by;
    AND p.master_categories_id != 7

    Still nothing. moved the semicolon to the bottom. Just caused a blank page.

    Is the newer coding for version 1.5 causing this? This SHOULD exclude category 7 from the New Products page yes?

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,883
    Plugin Contributions
    6

    Default Re: Exclude a category from new products migration

    This is the one that you want to use:
    Code:
    WHERE p.products_status = 1
    AND p.master_categories_id != 7
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $display_limit . $order_by;
    and any Product with master_categories_id 7 will not be included ...

    Check your Product(s) if still showing and make sure that the master_categories_id is 7 ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  7. #7
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    272
    Plugin Contributions
    0

    Default Re: Exclude a category from new products migration

    Quote Originally Posted by Ajeh View Post
    If you want to control the New Products then it would be in the module or sidebox or listing for New Products ...

    /includes/modules/pages/products_new/header_php.php
    /includes/modules/sideboxes/whats_new.php
    /includes/modules/new_products.php

    be sure to use your templates and overrides for any changes that you make ...

    NOTE: the header file does not have a templates and overrides for it ...
    Hi Linda,

    I must be a dummy - I still cannot stop a product category showing up in new products (v1,3,9). As your response did not indicate what code to change or add I used the line "AND p.master_categories_id != 7" from the next post of yours, however I noted that the discussion was for v1.5. I added this "line" to existing code in each of the 3 files you mentioned and still no joy.

    It is very frustrating because I have a product category that is purely ARTICLES which I add in blocks of 20 or more every so often for SEO purposes (using a product category because EZ-pages was an issue) - so suffice to say sometimes the whole new products display box (center) is full of articles (which are not really meant for customers anyway - take a look).

    So looking for an "exclusion code" if there is such a thing.

    cheers,
    Mike

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,883
    Plugin Contributions
    6

    Default Re: Exclude a category from new products migration

    Could you go into phpMyAdmin and search for the products_id that you do not want to see and see what their master_categories_id are?
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  9. #9
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    272
    Plugin Contributions
    0

    Default Re: Exclude a category from new products migration

    Quote Originally Posted by Ajeh View Post
    Could you go into phpMyAdmin and search for the products_id that you do not want to see and see what their master_categories_id are?
    Linda - not sure where to find "phpMyAdmin" ? Checking other sources, category listing in admin, the category I.D. to be excluded is 23. In the line "AND p.master_categories_id != 7" mentioned above I changed 7 to read 23 with no result. Here are the codes as they now exist - maybe I have the "line" of code mentioned above in the wrong order?

    from /includes/modules/pages/products_new/header_php.php

    // $display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();

    $products_new_query_raw = "SELECT p.products_id, p.products_type, pd.products_name, p.products_image, p.products_price,
    p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.products_model,
    p.products_quantity, p.products_weight, p.product_is_call,
    p.product_is_always_free_shipping, p.products_qty_box_status,
    p.master_categories_id
    FROM " . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_MANUFACTURERS . " m
    ON (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd
    WHERE p.products_status = 1
    AND p.master_categories_id != 23
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $display_limit . $order_by;

    from /includes/modules/new_products.php

    // initialize vars
    $categories_products_id_list = '';
    $list_of_products = '';
    $new_products_query = '';

    $display_limit = zen_get_new_date_range();

    if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_status = 1 " . $display_limit;
    } else {
    // get all products and cPaths in this subcat tree
    $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);

    if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
    // build products-list string to insert into SQL query
    foreach($productsInCategory as $key => $value) {
    $list_of_products .= $key . ', ';
    }
    $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma

    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_status = 1
    and p.master_categories_id != 23
    and p.products_id in (" . $list_of_products . ")";
    }
    }

    from /includes/modules/sideboxes/whats_new.php

    // display limits
    // $display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();
    $random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
    p.master_categories_id
    from (" . TABLE_PRODUCTS . " p
    left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.master_categories_id != 23
    and p.products_status = 1 " . $display_limit;

    I have also attached a screen capture of the index page showing my problem - not sure if it will show up - if not then just click on my site link below - obviously new products images rotate so you may need to leave home page then return to see it - just a bunch of Articles using the same image - looks terrible to say the least. (I wouldn't shop here, would you?)

    The reason I use a Product Category to insert Articles is that when using EZ Pages I cannot find a way to add meta descriptions, keywords etc for SEO benefit (the only reason I bother with articles in the first place)

    Name:  screen capture.jpg
Views: 56
Size:  19.3 KB

    So Linda, I very much look forward to your help here.

    cheers,
    Mike
    Last edited by shags38; 26 Apr 2012 at 01:44 AM. Reason: additional info

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,883
    Plugin Contributions
    6

    Default Re: Exclude a category from new products migration

    phpMyAdmin is located in your domain hosting Control Panel such as cPanel ...

    If you are not sure how to get to it, contact your hosting provider and ask them ...

    Also in the file:
    /includes/modules/new_products.php

    there are two places to add this ... you missed one of the $new_products_query you only added it to one part ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Exclude one category from shipping allow by 0 in stock
    By mdo82 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 26 Feb 2011, 09:56 AM
  2. Can I exclude a category??
    By Donovank in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 3 Dec 2009, 04:54 AM
  3. Possible to exclude linked items in main category () ?
    By Typhoon in forum General Questions
    Replies: 4
    Last Post: 10 Sep 2008, 12:32 AM
  4. Exclude Category from New Products Box?
    By deepfrydaniel in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 25 Aug 2007, 08:22 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
  •