How to add SKU to Product Description [Resolved]

Started by Deal-or-die, March 29, 2014, 05:24:28 AM

Previous topic - Next topic

Deal-or-die

G'day,
I've recently been setting up an AbanteCart to sell machine parts.
As machine parts are basically all referred to by part number, I'm interested if anyone was able to give me a hand to display the SKU(Already included in the 'insert product' feild) in the product description. Or even better, add another field in the product creation which allows me to set a part number to a product. The part number has to be searchable. If ANYONE is able to help me out here, it would be hugely appreciated.

Example(This is a photoshoped image of what I want.)


Cheeers!
John

abantecart

You can include SKU into template.

Edit this file between lines 234-258:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default_html5/template/pages/product/product.tpl

Find where you need it to be.

add:

<?php echo $product_info['sku']; ?>
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Deal-or-die

#2
Cheeers mate!

EDIT: Okay, just before you go ahead and read all this, I resolved this issue. I'll explain below how I did so.

I have added the following

                  <?php if ($model) { ?>
                     <li><span class="productinfoleft"><?php echo $text_sku; ?></span> <?php echo $product_info['sku']; ?>
                     </li>
                  <?php } ?>

Which is a bit naughty using 'if ($model)' for my SKU buuuuuuuuut if I use 'if ($sku)' nothing appears in the product description.

Now that I've got the SKU showing in the product description... Anyway to change "sku" too display as "Part number"?
I did try changing
                  <?php if ($model) { ?>
                     <li><span class="productinfoleft"><?php echo $text_sku; ?></span> <?php echo $product_info['sku']; ?>
                     </li>
                  <?php } ?>
to
                  <?php if ($model) { ?>
                     <li><span class="productinfoleft"><?php echo $text_partnumber; ?></span> <?php echo $product_info['sku']; ?>
                     </li>
                  <?php } ?>
and then defining '$text_partnumber' in the \storefront\language\english\product\product.xml as follows.

   <definition>
      <key>text_partnumber</key>
      <value><![CDATA[Part Number:]]></value>
   </definition>
However this only achieved the whole 'sku' line disappearing from product description again. Which lead me to using the default '<?php echo $text_sku; ?>' and just change the 'text_sku' definition to 'Part number'. This brought back the 'sku' line however the line still stated 'sku' instead of 'Part number'.

From here... I'm lost. Not sure where else I can go from here. :/ :P

(I apologise for the ill or non existent use of the 'code' tags, however when ever I used them I received an error stating "Sorry, you are not allowed to post external links.")

Another thank you in advance and hope you were able to follow ^ :P!
Cheers!

EDIT: Okay, for some reason the 'text_sku' isn't defined in the language folder and must be defined elsewhere.
After playing around with things like clearing Caches Ect. ect. I stumbled upon the 'Language Definitions' in the admin control panel located in 'System > Localisation > Language Definitions' simply changed 'sku' to 'Part Number' and I was all good to go which worked out great. Just to be sure I hadn't screwed up somewhere in the Language folder trying to manually modify it, I double checked the 'text_sku' posted previously in my reply under '\storefront\language\english\product\product.xml' but found the 'text_sku' to be unmodified and still displaying.

   <definition>
      <key>text_sku</key>
      <value><![CDATA[sku:]]></value>
   </definition>


Forum Rules Code of conduct
AbanteCart.com 2010 -