View Single Post
  #1  
Old 02-10-2017, 07:44 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Moving Related Products to a tab

I can't seem to get this working.

Creating the tab is easy enough and works...

Code:
namespace XLite\Module\Client\ClientTabRelatedProducts\View; abstract class DefineTabFindUpsells extends \XLite\View\Product\Details\Customer\Page\APage implements \XLite\Base\IDecorator { /** * Define tabs * * @return array */ protected function defineTabs() { $list = parent::defineTabs(); $tmp = $this->getData(); if ($tmp>0) { $list['Related Products'] = array( 'list' => 'product.details.page.tab.related', ); } return $list; } /** * Get currently viewed product ID * * @return integer */ protected function getProductId() { return intval(\XLite\Core\Request::getInstance()->product_id); } protected function getSearchConditionFirst() { return new \XLite\Core\CommonCell(); } /** * Return params list to use for search * * @return \XLite\Core\CommonCell */ protected function getSearchCondition() { $cnd = $this->getSearchConditionFirst(); $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_PARENT_PRODUCT_ID} = $this->getProductId(); return $cnd; } /** * Return products list - tweaked - just need to find if there are related products and then show tab * * @param \XLite\Core\CommonCell $cnd Search condition * @param boolean $countOnly Return items list or only its size OPTIONAL * * @return mixed */ protected function getData() { if (!isset($this->upsellingProducts) && $this->checkTarget()) { $cnd = $this->getSearchCondition(); $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_PARENT_PRODUCT_ID} = $this->getProductId(); $products = array(); $up = \XLite\Core\Database::getRepo('XLite\Module\XC\Upselling\Model\UpsellingProduct') ->search($cnd, false); foreach ($up as $product) { $products[] = $product->getProduct(); } $this->upsellingProducts = $products; } return count($this->upsellingProducts); } }

The above shows an extra tab when there are related products available.

But I can't seem to move the Related Products area to my new tab.

Code:
{## # Product details tab # # # @ListChild(list="product.details.page.tab.related") #} {{ widget_list('itemsList.product.cart') }} <div class="products"> {% if this.getPageData() %} <div class="products-list"> ...
Does work as the getPageData method can't be found.

How do I do this?
__________________
Core version: 5.5.xx
Reply With Quote