Author Topic: How to add SKU to Product Description [Resolved]  (Read 9875 times)

Offline Deal-or-die

  • Newbie
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
How to add SKU to Product Description [Resolved]
« on: March 29, 2014, 05:24:28 AM »
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
« Last Edit: March 30, 2014, 08:51:08 AM by Deal-or-die »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4367
  • Karma: +302/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: How to add SKU to Product Description
« Reply #1 on: March 29, 2014, 07:01:45 PM »
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:
Code: [Select]
<?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

Offline Deal-or-die

  • Newbie
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Re: How to add SKU to Product Description [Resolved]
« Reply #2 on: March 30, 2014, 08:32:27 AM »
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>

« Last Edit: March 30, 2014, 08:50:40 AM by Deal-or-die »

 

Powered by SMFPacks Social Login Mod