AbanteCart Community

eCommerce construction => How-to questions => Topic started by: Ian Atienza on June 04, 2020, 08:23:05 AM

Title: Display Product Options SKU on Product Page
Post by: Ian Atienza on June 04, 2020, 08:23:05 AM
Hello all, we were able to display the SKU from the general tab of the product, but when we use product options SKU, it is not appearing on the product page. We used the code found here also on the template page (products.tpl): "<b>SKU:&nbsp</b><?php echo $product_info['sku']; ?>" Can anyone help us please on this and make the options SKU appear on the page? Many thanks in advance to this community!

(https://i.ibb.co/7YCGk4p/screencapture-kiddcoderacing-index-php-2020-06-04-20-16-16.png)
(https://i.ibb.co/ncGrM7D/screencapture-kiddcoderacing-index-php-2020-06-04-20-16-03.png)
Title: Re: Display Product Options SKU on Product Page
Post by: abolabo on June 04, 2020, 08:43:46 AM
sorry, not sure understood you right. For example you have some product option type radio or selectbox. Where sku must be shown when some value selected?
Are you talking about some js-script that shows sku of selected value of option? right?
I think the best way to customize your template (product.tpl).
You can get all options with values of product via php
Code: [Select]
<?php $product_options $this->model_catalog_product->getProductOptions($product_id); ?> and pass into your own javascript code.
Then bind "onchange" event on each form element of product options form to show sku wherever you want on page.
Title: Re: Display Product Options SKU on Product Page
Post by: Ian Atienza on June 04, 2020, 09:17:20 AM
Thank you for the inputs! We were successful in making the SKU appear on the product page using the "SKU input in the general tab of products", but when we inputted on the product options, it is not appearing on the product page.

<?php echo $product_info['sku']; ?> worked using the SKU input on the general tab.