Claudia M 4 Posted November 25 (edited) I have admin/store settings/layout/ products per page set to 15. I also changed my skin/config to 15. <layout> <products> <perpage amount="6" /> <perpage default="true" amount="15" /> <perpage amount="24" /> <perpage amount="48" /> <perpage amount="96" /> </products> </layout> But look at these pages. The first page is only showing 14 products. https://www.claudiasbargains.com/bottles-jars-and-jugs.html?page=1 https://www.claudiasbargains.com/decorative-display-and-collectibles.html?page=1 https://www.claudiasbargains.com/telephones-and-radios.html?page=1 https://www.claudiasbargains.com/tins-and-containers.html?page=1 But these categories that has more than one page shows 15 products https://www.claudiasbargains.com/electric-oil-warmers.html?page=1 https://www.claudiasbargains.com/fragrances.html?page=1 https://www.claudiasbargains.com/toys-games-and-vehicles.html?page=1 Anybody know what is causing this? Thanks for any and all help Claudia I just noticed this: First Page showing 10 products. Look at the third page https://www.claudiasbargains.com/cigar-and-other-boxes.html?page=1 https://www.claudiasbargains.com/cigar-and-other-boxes.html?page=3 Edited November 25 by Claudia M Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 I recently assisted someone with having the skin skip over any product that was not available for purchase. For that person, the skin edit took the collection of the default amount of items per page (15), and skipped over some (none, some, or all, actually). To truly get a full collection of the default amount, making sure to query the database to take into this additional condition, will require an edit to the codebase (maybe a code snippet would do). Do you have any thing that would skip over or remove items that fail to match any additional conditions? Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 I was that person!!!! Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 That edit probably explains why some pages sometimes return less than the default number of products. Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 How can that be corrected Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 (edited) As of CC628, there isn't a hook available to incorporate a WHERE clause in the database query made where CubeCart gets the collection of all products that belong to the target category. As discussed, hiding out-of-stock products will also cause a 'product not found' message to display when wanting to actually view an out of stock product. This is not the same as what you want to do. Do you agree to modify the core code? If so, try: In /classes/catalogue.class.php, near line 727, find: public function getCategoryProducts($category_id, $page = 1, $per_page = 10, $hidden = false) A few lines later, find: $where2 = $this->outOfStockWhere(false, 'INV', true); On a blank line above that, add: $where = " AND INV.available > 0"; EDIT: Fixed the above. Be sure to restore the edit to the skin, just to remove any influence that may have. Oops! Forgot something. A few lines after that, find: 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) { Change to: 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'.$where.$where2)) !== false) { Edited November 25 by bsmither Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 After making the changes and clearing the cache I get a white screen in admin and my store. Here's the changes I made: ( and I deleted the previous code from skin/category 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 > 0" $where2 = $this->outOfStockWhere(false, 'INV', true); 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'.$where.$where2)) !== false) { $this->_category_count = $GLOBALS['db']->numrows(); if (isset($_GET['sort']) && is_array($_GET['sort'])) { foreach ($_GET['sort'] as $field => $direction) { $order[$field] = (strtolower($direction) == 'asc') ? 'ASC' : 'DESC'; break; } Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 Put a semicolon after the new line: $where = " AND INV.available > 0"; Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 "Be sure to restore the edit to the skin, just to remove any influence that may have. " Did you mean for me to remove the edit? Because now my sold items are showing in the category page with a "see Listing" and on the product page it correctly shows my modifiedThe item item has been sold. Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 Enable debugging. When viewing a category, find the query that starts with SELECT I.product_id FROM and has AND INV.available > 0. Copy it to your reply. Double check that this product has the Available checkbox cleared. Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 here you go SELECT I.product_id FROM `CubeCart_category_index` as I, `CubeCart_inventory` as INV WHERE I.cat_id = 157 AND I.product_id = INV.product_id AND INV.status = 1 AND INV.available > 0 AND `live_from` < UNIX_TIMESTAMP() -- (0.00084900856018066 sec) [NOT CACHED] Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 Double check that this product has the Available checkbox cleared. Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 I did before and i checked one just now and they don't. Quote Share this post Link to post Share on other sites
bsmither 1,340 Posted November 25 Well, it seems the database column for 'available' is an ENUM data type. The values it can take is a string '0' or a string '1', as opposed to integer values. That means the query needs to be very specific. Try: $where = " AND INV.available = '1'"; From the other conversation, the image capture, the right button says SOLD, but the code says "See Listing". Also, this project has not been tested for search results nor sale items. Quote Share this post Link to post Share on other sites
Claudia M 4 Posted November 25 That seems to have done it!! Don't worry about the SOLD and See Listing. That was some edits I made in the skin/category template for items on Etsy or eBay. I might put them back to stock since they don't show now either. Which I like. I don't use sale items and the search results I really don't care about. Thank you so much Brian. As always!!!! Quote Share this post Link to post Share on other sites
Claudia M 4 Posted Friday at 04:04 PM Brian, Is there any way to exclude a certain category or two from this. I don't want it to show my sold products but I'd like for it to show my eBay and Etsy listings that aren't available for purchase in my store. I can create a special category for them. Thanks as always, Claudia Quote Share this post Link to post Share on other sites
Claudia M 4 Posted Friday at 05:27 PM Nevermind. I figured it out Quote Share this post Link to post Share on other sites