Jump to content
Sign in to follow this  
desan

Одновременное отображение названия товара на 2 языках

Recommended Posts

Мы можем как-то вывести в карточке товара основное название на русском и чуть ниже на английском?

Share this post


Link to post
Share on other sites

Можете.

Share this post


Link to post
Share on other sites

Можете.

 

:mrgreen: :geek:

Share this post


Link to post
Share on other sites

Можете

 

 

 

Было бы замечательно узнать как :)

Буду очень благодарен если расскажите :)

 

Версия ocstore 1.5.5.1.2....

Share this post


Link to post
Share on other sites

В модели товара добавить метод

	public function getProductDescriptions($product_id) {
		$product_description_data = array();
		
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
		
		foreach ($query->rows as $result) {
			$product_description_data[$result['language_id']] = array(
				'name'             => $result['name'],
				'description'      => $result['description']
			);
		}
		
		return $product_description_data;
	}

В контроллере товара  - сделать его вызов.

$descriptions = $this->model_catalog_product->getProductDescriptions($product_id); 

В шаблоне товара сделать вывод $descriptions как душе вздумается

<?php foreach ($descriptions as $description) { ?>
....
<?php } ?>

Share this post


Link to post
Share on other sites

Спасибо за помощь! 

Edited by desan

Share this post


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
You are posting as a guest. If you have an account, please sign in.
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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.