View Single Post
  #2  
Old 08-13-2014, 12:03 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Show product variant in list view instead of drop down

Hi!

This is an example of how to pull info about variants:

PHP Code:
<?php

require_once 'top.inc.php';

$product = \XLite\Core\Database::getRepo('\XLite\Model\Product')->find(22);

$variants $product->getVariants();
foreach (
$variants as $variant) {
    echo 
'qty ' . (($variant->defaultAmount) ? $product->getQty() : $variant->amount) . 
    
'; price ' .  (($variant->defaultPrice) ? $product->price $variant->price) . '<br /><br />';
}

This is a PHP script that must be put into X-Cart 5's root folder.

Hopefully, it will help.

If there is further help needed, please explain a bit what result you are trying to achieve. I still did not grasp it. Do you want to list product attributes on product lists (like category pages) or something different?

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote