Forum
Inactive products displaying
Coming across a weird scenario. I am setting up a shop, and the owner has multiple items that we're setting to inactive within the CMS until she's got her inventory ready. Initially setting items to Inactive worked as it should, but now they seem to be showing up both in the product list and the product view.
I've come up with a very crude work around for the time being to hide the items, (because I need to get a couple items up today) but it illustrates (at least to me) that the status id has the correct value. I've set up a <perch:if id="status" value="1"> statement around the product list item:
<perch:if id="status" value="1">
<li class="card">
<div class="card-img">
<img src="<perch:shop type="image" id="image" width="700" height="700" crop="true" />" alt="<perch:shop id="title" type="text" />" >
</div>
<div class="card-copy">
<a href="/shop/products/product?s=<perch:shop id="slug" type="slug" />" class="card_heading-link" >
<h2><perch:shop id="title" type="text" /></h2>
</a>
<div class="card-text_wrap">
<perch:shop id="description" type="textarea" html="true" chars="140" append="..." />
</div>
</div>
<div class="product_card-button_wrap">
<a href="/shop/products/product?s=<perch:shop id="slug" type="slug" />" class="button button--small">Product Details</a>
<perch:if not-exists="has_variants">
<perch:form id="add_to_cart" app="perch_shop" action="/cart/">
<perch:input id="product" type="hidden" value="<perch:shop id="productID" env-autofill="false" />" />
<perch:input type="submit" value="Add to cart" class="button button--small" />
</perch:form>
</perch:if>
</div>
</li>
</perch:if>
With this in place, only the active products display. However, the pagination still doesn't recognize that items are inactive - There are 27 items in the shop, with only 2 currently active. It still wants to display all 3 pages, as if all 27 items are showing (I have 9 products per page). So 1 shows up on page 1, and 1 shows up on page 3 and page 2 is empty. I have hid the pagination for now, (by commenting it out in list.html) - but have also had to sort my products by their status in order to ensure they aren't dispersed across multiple pages. (i.e. so that they all show up on the first page )
<?php
perch_shop_products([
'count' => 9,
'paginate' => true,
'sort' => 'status',
'sort-order' => 'DESC',
]);
?>
Here is my Diagnostics Report:
Perch Runway: 2.8.32, PHP: 5.6.27, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0), perch_forms (1.8.3), perch_gallery (2.8.6), perch_shop_orders (1.0.8), perch_shop_products (1.0.8), perch_shop (1.0.8), perch_members (1.5), perch_podcasts (1.2), perch_mailchimp (3.0.1), perch_twitter (3.6.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_podcasts', 'perch_forms', 'perch_mailchimp', 'perch_gallery', 'perch_blog', 'perch_members', 'perch_shop', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /chroot/home/qof/dev.quilteronfire.com/html/perch
PERCH_CORE: /chroot/home/qof/dev.quilteronfire.com/html/perch/core
PERCH_RESFILEPATH: /chroot/home/qof/dev.quilteronfire.com/html/perch/resources
Image manipulation: GD
PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: dev.quilteronfire.com
DOCUMENT_ROOT: /home/qof/dev.quilteronfire.com/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
I have gone into the products, set them to active, saved, and then back to inactive and saved again, hoping it would help. But didn't my next thought would be to delete the products and re-add them. However that is painstaking, and if this happens again is the client going to have to go through that entire process? (Assuming it works). And what if I had a shop with 200 products instead of 27?
I hope I'm missing something obvious, but I can't figure out what that might be.
I think you're a version behind on Shop.
Thanks Drew, Will update, and let you know. On a side note - wouldn't it be helpful if my "Health Check" told me my add-ons were out of date - similar to how it tells me the Core is out of date?
Yes it would be. Perch 3 does that.