View Single Post
  #1  
Old 08-12-2014, 07:45 AM
 
jp@ewaycorp.com jp@ewaycorp.com is offline
 

Member
  
Join Date: Aug 2009
Posts: 23
 

Lightbulb Show product variant in list view instead of drop down

Hello Everyone & Specially Tony , i have been using x-cart 5 for my new project and quite like working on it.

Now i have to show product variant in list view instead of drop down list along with their name, price, sku, qty, Add to cart button.

My Product consist of "ARTIST/AUTHOR" And "MEDIA TYPE" Attribute.

Now my variant are based on "MEDIA TYPE" Attribute.

I have seen one of your example and created this

PHP Code:
<?php

namespace XLite\Module\EwayCorp\EdactSkin\View\Product\Details\Customer\Page;

abstract class 
APage extends \XLite\View\Product\Details\Customer\Page\APage implements \XLite\Base\IDecorator
{
    protected function 
getArtistAttributes() 
    { 
        
$attributesToDisplay = array ('ARTIST/AUTHOR'); 

        
$return = array(); 

        
$widgets $this->getAttributesWidgets(); 

        foreach (
$widgets as $widget) { 

            foreach (
$widget->getAttrList() as $attribute) { 

                if (
in_array(strtoupper($attribute['name']), $attributesToDisplay)) { 

                    
$return[] = $attribute

                } 

            } 

        } 

        return 
$return
    }  
    protected function 
getMediaTypeAttributes() 
    { 
        
$attributesToDisplay = array ('MEDIA TYPE'); 

        
$return = array(); 

        
$widgets $this->getAttributesWidgets(); 

        foreach (
$widgets as $widget) { 

            foreach (
$widget->getAttrList() as $attribute) { 

                if (
in_array(strtoupper($attribute['name']), $attributesToDisplay)) { 

                    
$return[] = $attribute

                } 

            } 

        } 

        return 
$return
    } 
}

I get getArtistAttributes() values as CSV for multiple values for authors/artists which is fine.

When i call getMediaTypeAttributes() i get only the names in CSV where want variant information like price, sku, qty etc..

Please help on how to achieve this and thanks in advance.
Reply With Quote