Author Topic: Offsetting the product list for a category  (Read 1144 times)

newsomjk

  • Jr. Member
  • **
  • Posts: 61
Offsetting the product list for a category
« on: July 18, 2013, 17:09:29 pm »
I've been trying to figure it out in the code for a day or two, but I figure it's time for me to move to the next thing in my checklist and come back to this.

What I want to do, is for just one specific category, skip the first product in the list but still display 10 items. We're pulling the newest product from that category and putting it at the top of the page with a promo banner, but we want to skip it in the list below so it's not showing twice back to back.

I've found and displayed the list of product ids, but I can't figure out where I would make it skip the first product. I've also managed to make it skip the first product for that category, but then only 9 items show instead of 10.

Anybody have an idea?

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2657
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: Offsetting the product list for a category
« Reply #1 on: July 18, 2013, 18:57:23 pm »
You could unpublish from specific category that one specific product.
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart

newsomjk

  • Jr. Member
  • **
  • Posts: 61
Re: Offsetting the product list for a category
« Reply #2 on: July 18, 2013, 21:49:15 pm »
Well the module pulls the latest product from the category, so if I unpublished it, wouldn't the module not find it in that category anymore?

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2657
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: Offsetting the product list for a category
« Reply #3 on: July 18, 2013, 22:30:55 pm »
Didn't hear about module at all.

Please link to the category page and the page with this module.

Just to understand more clearly.
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart

newsomjk

  • Jr. Member
  • **
  • Posts: 61
Re: Offsetting the product list for a category
« Reply #4 on: July 19, 2013, 17:57:30 pm »
It's a custom module. Here's the code for the module, and I'll attach an image showing what I mean.

Code: [Select]
<?php
defined
('_JEXEC') or die('Direct access to this location is not allowed.');

$document =& JFactory::getDocument();

$color $params->get('color');
$fcolor $params->get('fcolor');
$css $params->get('css');

$db =& JFactory::getDBO();

$style '
#newestProduct{
background:#'
.$color.';
color:#'
.$fcolor.';
'
.$css.'
}
'
;
$document->addStyleDeclaration($style);

$query 'SELECT p.product_sku,p.virtuemart_product_id,pe.product_name,pe.product_s_desc
FROM #__virtuemart_products p, #__virtuemart_products_en_gb pe, #__virtuemart_product_categories pc
WHERE p.published = 1 AND p.product_parent_id = 0 AND p.virtuemart_product_id = pe.virtuemart_product_id
AND pc.virtuemart_product_id = p.virtuemart_product_id AND pc.virtuemart_category_id = 1
ORDER BY p.created_on DESC LIMIT 1'
;

$db->setQuery($query);
$prod $db->loadAssoc();

?>


<h5>Just Published </h5>
<div class="fullColumn flatBottom" id="newestProduct">
<div class="threeColumn">
<img src="images/product-banners/<?php echo $prod['product_sku']; ?>.png" />
</div>

<div class="twoThreeColumn">
<?php 
$url 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $prod['virtuemart_product_id'];
echo '<a href="'.$url.'" style="color:#FFF;">'.$prod['product_name'].'</a>';
echo '<p class="product_description">'.$prod['product_s_desc'].'</p>';
$button_lbl 'More Info';
$button_cls 'addtocart_button buttonOrange small';
?>

<br/>
<a href="<?php echo $url?>" style="float:right;" class="buttonOrange small">More Info</a>

</div>
</div>
<div class="lineborder blank"></div>



[attachment cleanup by admin]

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2657
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: Offsetting the product list for a category
« Reply #5 on: July 21, 2013, 22:50:37 pm »
You could unpublish from specific category that one specific product.
And assign mentioned product to another category responsible for displaying product in your module.
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart