php - Opencart multiple product template based on stock status -


i want create 1 or 2 more product templates products in opencart store. supplier has restrictions on products can , can't sold online.

  • some products allowed sold online , prices can displayed
  • some products can have price online, no add cart button , display "available in-store only"
  • some products can't have price or add cart

would possible make 2 product templates change depending on assigned stock status? op in linked post, want can changed in options menu.

opencart - view alternate product template based on arbitrary product field

you can make specific template products don't want sell without price or add cart button.

there way, can make specific template each product. need edit /catalog/controller/product/product.php , find line:

if (file_exists(dir_template . $this->config->get('config_template') . '/template/product/product.tpl')) {             $this->template = $this->config->get('config_template') . '/template/product/product.tpl';         } else {             $this->template = 'default/template/product/product.tpl';         } 

and replace with:

 if (file_exists(dir_template . $this->config->get('config_template') . '/template/product/product.tpl')) {         '/template/product/product.tpl';              $this->template = $this->config->get('config_template') . '/template/product/product_' . $this->request->get['product_id'] . '.tpl';             if (!file_exists(dir_template . $this->template)) {             $this->template = $this->config->get('config_template') . '/template/product/product.tpl'; }             } else {                 $this->template = 'default/template/product/product.tpl';             } 

now can create specific template easy , no need modificate opencart when need unique page. in /catalog/view/theme/yourtemplate/template/product/product.php , if want specific template 1 product make file called product_id.tpl


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -