Claudia M Posted November 20, 2019 Share Posted November 20, 2019 I have modified my category page to show an item as sold when it sells. My category page is VERY modified. What I need is for the sold items to NOT show in their category page at all. I still want to keep them in the category just don't want them to show on the category page. Why? Well if someone clicks on the item in say Pinterest I still want them to go to that page because it shows my related products that they may decide to purchase. Store Settings: Global Sock Warning -1 Hide out of stock products checked. Thanks for any help. Link to comment Share on other sites More sharing options...
bsmither Posted November 21, 2019 Share Posted November 21, 2019 We need to know if your CubeCart code version gives the 'available' parameter for a product. If so, in the skin template content.category.php, find: {foreach from=$PRODUCTS item=product} On a new blank line after that, add: {if $product.available le 0}{continue}{/if} Link to comment Share on other sites More sharing options...
Claudia M Posted November 21, 2019 Author Share Posted November 21, 2019 That didn't work. Here is my code: {/if} <div id="ccScroll"> <ul class="small-block-grid-1 medium-block-grid-3 large-block-grid-3 product_list" data-equalizer> {foreach from=$PRODUCTS item=product} <li> <form action="{$VAL_SELF}" method="post" class="panel add_to_basket"> <div class="product_grid_view"> <div data-equalizer-watch> <div class="text-center"> <a href="{$product.url}" title="{$product.name}"><img class="th" src="{$product.thumbnail}" alt="{$product.name}"></a> </div> <h6 class="pad-top"><a href="{$product.url}" title="{$product.name}">{$product.name|truncate:65:"…"}</a></h6> </div> <div class="medium darkred">Product Code: {$product.product_code}</div> <div class="pad-bottom bold"> {if $product.available and $product.ctrl_stock} {if $product.ctrl_sale}<span class="old_price">{$product.price}</span> <span class="sale_price">{$product.sale_price}</span> {else} {$product.price} {/if} {else} {/if} </div> {if $product.available <= 0} <div class="row collapse marg-top"> <div class="small-12 columns"> <div> <a href="{$product.url}" title="{$product.name}" class="button medium secondary radius left">More Info</a></div> <a href="{$product.url}" title="{$product.name}" <input type="submit" class="button disabled medium radius right" disabled>See Listing </a> </div> </div> Link to comment Share on other sites More sharing options...
bsmither Posted November 21, 2019 Share Posted November 21, 2019 I see in your code that there is {$product.available}, so if the edit does not work, either: * CubeCart's internal cache was not cleared and a cached unedited template was used, or * The parameter {$product.available} must be true-ish even though it is out of stock (can be made true-ish by overridding with an admin setting, or by a logged-in admin viewing the page). Link to comment Share on other sites More sharing options...
Claudia M Posted November 21, 2019 Author Share Posted November 21, 2019 I cleared the cache from admin and also deleted the files from cPanel. When I unchecked available for purchase and use stock level from the product page in admin it worked. It is no longer showing in the category page. Thanks Brian Link to comment Share on other sites More sharing options...
Claudia M Posted November 22, 2020 Author Share Posted November 22, 2020 Hey Brian, I upgraded to 6.4.1 and this is not working. All my sold items are now showing in the category page. What do I need to do? Thanks Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2020 Share Posted November 22, 2020 Please post what you have in your skin that checks for {$product.available} near this statement: In the skin template content.category.php {foreach from=$PRODUCTS item=product} << What do you have here? >> Link to comment Share on other sites More sharing options...
Claudia M Posted November 22, 2020 Author Share Posted November 22, 2020 Here you go: <div id="ccScroll"> <ul class="small-block-grid-1 medium-block-grid-3 large-block-grid-3 product_list" data-equalizer> {foreach from=$PRODUCTS item=product} <li> <form action="{$VAL_SELF}" method="post" class="panel add_to_basket"> <div class="product_grid_view"> <div data-equalizer-watch> <div class="text-center"> <a href="{$product.url}" title="{$product.name}"><img class="th" src="{$product.thumbnail}" alt="{$product.name}"></a> </div> <div class="cat-prodname"><a href="{$product.url}" title="{$product.name}">{$product.name|truncate:50:"…"}</a></div> </div> <div class="medium13 red pad-top">Product Code: {$product.product_code}</div> <div class="pad-bottom bold"> {if $product.available and $product.ctrl_stock} {if $product.ctrl_sale}<span class="old_price">{$product.price}</span> <span class="sale_price">{$product.sale_price}</span> {else} {$product.price} {/if} {else} {/if} </div> {if $product.available <= 0} <div class="row collapse marg-top"> <div class="small-12 columns"> <div> <a href="{$product.url}" title="{$product.name}" class="button medium secondary radius left">More Info</a></div> <!-- <input type="submit" value="See Listing" class="button medium radius right" disabled> --> </div> </div> {* ctrl_stock True when a product is considered 'in stock' for purposes of allowing a purchase, either by actually being in stock or via certain settings *} {elseif $product.ctrl_stock && !$CATALOGUE_MODE} <div class="row collapse thinmarg-top"> <div class="small-12 columns"> <div> <a href="{$product.url}" title="{$product.name}" class="button medium secondary radius left">More Info</a></div> <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="button medium radius right">Add to Basket</button> <input type="hidden" name="add" value="{$product.product_id}"> </div> </div> {elseif !$CATALOGUE_MODE} <div class="row collapse marg-top"> <div class="small-12 columns"> <div> <a href="{$product.url}" title="{$product.name}" class="button medium secondary radius left">More Info</a></div> <!-- <div> <a href="{$product.url}" title="{$product.name}" class="button medium secondary radius right disabled"> </a></div> --> <!-- <input type="submit" value="See Listing" class="button medium disabled radius right" disabled> --> </div> </div> {/if} </div> </form> </li> {foreachelse} {if !isset($SUBCATS) || !$SUBCATS} <li>{$LANG.category.no_products}</li> {/if} {/foreach} </ul> <div class="row"> <div class="small-12 large-9 columns"> {$PAGINATION} </div> </div> Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2020 Share Posted November 22, 2020 This edit should still work: in the skin template content.category.php, find: {foreach from=$PRODUCTS item=product} On a new blank line after that, add: {if $product.available == '0'}{continue}{/if} Link to comment Share on other sites More sharing options...
Claudia M Posted November 22, 2020 Author Share Posted November 22, 2020 Thanks Brian that took care of the products showing but the pagination is still showing the amount of pages as if the products were still there. https://www.claudiasbargains.com/boxes-crates-and-drawers.html Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2020 Share Posted November 22, 2020 Ok, I can see how this isn't the best solution. Do you recall what you actually did to filter out 'not available' products in CC629? It could be a code snippet, or a hard-edit to the catalogue.class.php file, getCategoryProducts() function.. Link to comment Share on other sites More sharing options...
Claudia M Posted November 22, 2020 Author Share Posted November 22, 2020 I don't think I changed anything like that. You may want to look at these topics from when we originally did this. https://forums.cubecart.com/topic/54725-remove-price-when-out-of-stock-or-unavailable/?tab=comments#comment-237277 I leave "available for Purchase" and Use stock level checked in the product after it is sold (it still shows in the category page at this time). When I'm sure the item has been delivered I uncheck them and this is when the item should not show in category Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2020 Share Posted November 22, 2020 The text link discusses showing buttons. The "Sold Items" is the conversation we are having now. There may be another conversation where we solved the task of not including products that are not available by adding a condition to a database query - as mentioned above. Link to comment Share on other sites More sharing options...
Claudia M Posted November 23, 2020 Author Share Posted November 23, 2020 Is this it in the class.catalogue public function getCategoryProducts($category_id, $page = 1, $per_page = 10, $hidden = false) { if (strtolower($page) == 'all') { $per_page = false; $page = false; } $where = " AND INV.available = '1'"; $where2 = $this->outOfStockWhere(false, 'INV', true); Link to comment Share on other sites More sharing options...
bsmither Posted November 23, 2020 Share Posted November 23, 2020 That's it! The next line should also have an edit: if (($result = $GLOBALS['db']->query('SELECT I.product_id FROM `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_category_index` as I, `'.$GLOBALS['config']->get('config', 'dbprefix').'CubeCart_inventory` as INV WHERE I.cat_id = '.$category_id.' AND I.product_id = INV.product_id AND INV.status = 1'.$where2)) !== false) { This part of that line: AND INV.status = 1'.$where2)) !== false) { should have an edit that reads: AND INV.status = 1'.$where.$where2)) !== false) { Link to comment Share on other sites More sharing options...
Claudia M Posted November 23, 2020 Author Share Posted November 23, 2020 That worked Brian. Thank You!! Have you had a chance to look at my post in Install and Upgrade about the images? Thanks for all you do!!!! Link to comment Share on other sites More sharing options...
bsmither Posted November 23, 2020 Share Posted November 23, 2020 I have looked at that post, and am exploring the new FileManager capabilities. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.