Jump to content

Sold Items


Claudia M

Recommended Posts

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.

Capture-Sold-Categories-400.png.494f1d2f69d02558feeb39e1ca4c9042.png

Capture-products-stock300.png.8d663078b1a264e93046a1d61280e99e.png

 

Link to comment
Share on other sites

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

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:"&hellip;"}</a></h6>
                  </div>
                <div class="medium darkred">Product Code:&nbsp;{$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}&nbsp;
{/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

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

  • 1 year later...

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:"&hellip;"}</a></div>
                  </div>
                <div class="medium13 red pad-top">Product Code:&nbsp;{$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}&nbsp;
{/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">&nbsp;</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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...