News:

Looking for documentation? Take a look on our wiki

Main Menu

Offsetting the product list for a category

Started by newsomjk, July 18, 2013, 17:09:29 PM

Previous topic - Next topic

newsomjk

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

You could unpublish from specific category that one specific product.
You can support Community by voting for Project on the JED
[url="https://extensions.joomla.org/extension/virtuemart/#reviews"]https://extensions.joomla.org/extension/virtuemart/#reviews[/url]
Join us at
[url="https://twitter.com/virtuemart"]https://twitter.com/virtuemart[/url]

newsomjk

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

#3
Didn't hear about module at all.

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

Just to understand more clearly.
You can support Community by voting for Project on the JED
[url="https://extensions.joomla.org/extension/virtuemart/#reviews"]https://extensions.joomla.org/extension/virtuemart/#reviews[/url]
Join us at
[url="https://twitter.com/virtuemart"]https://twitter.com/virtuemart[/url]

newsomjk

It's a custom module. Here's the code for the module, and I'll attach an image showing what I mean.

<?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

Quote from: Maxim Pishnyak on July 18, 2013, 18:57:23 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.
You can support Community by voting for Project on the JED
[url="https://extensions.joomla.org/extension/virtuemart/#reviews"]https://extensions.joomla.org/extension/virtuemart/#reviews[/url]
Join us at
[url="https://twitter.com/virtuemart"]https://twitter.com/virtuemart[/url]