Jump to content

Категория товара


Go to solution Solved by Виталий Анатольевич,

Recommended Posts

Здравствуйте!

Подскажите пожалуйста, как на странице подтверждения заказа (example.com/order) получить категорию товара для каждого из элементов заказа, чтобы использовать конструкцию вида:

 

 

{foreach $purchases as $key => $purchase}
{$purchase->category|escape}
{/foreach}

 

Прикручиваю электронную торговлю Аналитикс, все данные передаются кроме категории. Т.к. один и тот же товар может принадлежать разным категориям, то нужно получать только первую.

Спасибо!

Link to post
Share on other sites
  • Solution

в файл OrderView.php добавить код

 

		foreach($products as &$product){
			$product->categories = $this->categories->get_categories(array('product_id'=>$product->id));
			$product->category = reset($product->categories);		
		}

перед

		foreach($purchases as &$purchase)
		{

 

это примерно 95 строка 

Link to post
Share on other sites
  • 4 months later...

На странице корзины можно вывести категорию товара добавив

foreach($products as &$product){
			$product->categories = $this->categories->get_categories(array('product_id'=>$product->id));
			$product->category = reset($product->categories);		
		}

 

 

код в api/Cart.php перед

foreach($items as $variant_id=>$item)
				{
Edited by дима
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...