Problem Cloning Feature Products
I am trying to clone the feature products feature and have it populate with 10 items from a particular category for the home page.
I modified the query and the display code to do this. The query pulls the correct number of items but the display only outputs some of the result set. For example if I set the query to pull 12 items the display code only outputs items 2,3 and 4...if I pull 24 items I get 15 items. I will admit I'm new to zen cart but I can honestly so no reason this would not output the entire set. Thank you in advance for any help you can provide.
Here is the query:
Code:
$specials_index_query = "select distinct p.products_id, p.products_image, 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.master_categories_id = '49' LIMIT 12";
if ($specials_index_query != '') $specials_index = $db->Execute($specials_index_query);
Here is the output code:
Code:
<?php
$foo = 1;
while (!$specials_index->EOF) {
echo $foo." ";
$products_price = zen_get_products_display_price($specials_index->fields['products_id']);
// pull products descriptio
// buy now button
$featured_buy = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton featuredModuleButton"') . '</a>';
if (!isset($productsInCategory[$specials_index->fields['products_id']])) $productsInCategory[$specials_index->fields['products_id']] = zen_get_generated_category_path_rev($specials_index->fields['master_categories_id']);
$list_box_contents_vibe[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . ' ',
'text' => (($specials_index->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<div class="featuredMain">' . '<div class="featuredName"><a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . $specials_index->fields['products_id']) . '">' . $specials_index->fields['products_name'] . '</a></div>' . '<div class="featuredImage"><a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . $specials_index->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $specials_index->fields['products_image'], $specials_index->fields['products_name'], '150', '150') . '</a></div>') . '<div class="featuredPrice">' . $products_price . '</div>' . '<div class="featuredButton">' . $featured_buy . '</div>' . '</div>');
$col ++;
if ($col > (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS - 1)) {
$col = 0;
$row ++;
}
$foo++;
$specials_index->MoveNext();
}
?>
<ul>
<?php
if (is_array($list_box_contents_vibe) > 0 ) {
for($row=0;$row<sizeof($list_box_contents_vibe);$row++) {
$params = "";
if (isset($list_box_contents_vibe[$row]['params'])) $params .= ' ' . $list_box_contents_vibe[$row]['params'];
?>
<?php
for($col=0;$col<sizeof($list_box_contents_vibe[$row]);$col++) {
$r_params = "";
if (isset($list_box_contents_vibe[$row][$col]['params'])) $r_params .= ' ' . (string)$list_box_contents_vibe[$row][$col]['params'];
if (isset($list_box_contents_vibe[$row][$col]['text'])) {
?>
<?php echo '<li>' . $list_box_contents_vibe[$row][$col]['text'] . '</li>' . "\n"; ?>
<?php
}
}
?>
<?php
}
}
?>
</ul>
Re: Problem Cloning Feature Products
You look to have copied the specials code
Check your settings for specials in the admin
Re: Problem Cloning Feature Products
Now that I think of it I did. Is there something in there that would prevent items from showing?
Oh! This?: if (!isset($productsInCategory[$specials_index->fields['products_id']])) doh! ty ty
Re: Problem Cloning Feature Products
Ok I'm still stuck on this. I removed the bit about looking up the category but I still only get a subset of the listing. kobra was entirely correct it is filtering my result set based on items found in the "specials" table but this is not desired and as much as I look at this I still see no reason for this to now simple pull from the result set.
My end goal is to be able to pull in items from different categories and display them in a slider on the home page.
If anyone could explain what is preventing this from displaying all of my results it would be greatly appreciated.
Re: Problem Cloning Feature Products
Quote:
If anyone could explain what is preventing this from displaying all of my results it would be greatly appreciated.
Where is this site?
What are your details? See guide to posting
How many products are being drawn?
Might it be 12?
Re: Problem Cloning Feature Products
I would post a link to the site but the products might offend some people as they are of an adult nature.
I am pulling 12 items and the while (!$specials_index->EOF) loop goes through 12 iterations. If I print out in the loop the $featured_buy and $products_price I get 12 buttons and 12 prices. The problem is that in the final output I only get 3 items...these three items are in the specials table so you were correct that it is something filtering for that table. My goal is to have this simple spit out 12 items from a specified category and have 3-4 categories on the home page.
I suspect that something in the setting of $list_box_contents_vibe filters out my other 9 items but I don't see anything that would. I wondered if there might be a simple bit I'm just missing.
Re: Problem Cloning Feature Products
Check all your settings for specials in the admin
Re: Problem Cloning Feature Products
The specials admin only seems to have a list of items.
Is there no way of just removing the link to specials from this? That is my goal. I only used specials because it seemed like a good starting point.
Thank you for your help btw.
Re: Problem Cloning Feature Products
Posting title
"Problem Cloning Feature Products"
Quote:
I only used specials because it seemed like a good starting point
Why didn't you start with "Featured"??
Re: Problem Cloning Feature Products
I believe I used specials. I started with featured and then switched. Sorry I'm new to this system and I'm still learning my way around.