image - Magento product weight - custom picture -


i want have code in magento, following:

  • gets product weight
  • depending on weight displays custom png

for example: if weight under 3 kg, displays shipping_1.png if weight between 3-5 kg, displays shipping_2.png, etc..

i think got use $product->getweight(); instance, since i'm not programmer, not know how go on it.

can me snippet, start?

thank you!

i not know how want show weight images, doing show weight image on product page under price.

it little hard no programming knowledge, need configure yourself, such image file path.

  1. firstly go folder:

    app/design/frontend/{package}/{theme}/template/catalog/product

  2. then find line :

    <?php echo $this->gettierpricehtml() ?>

    this code print out product price, should around line 60

  3. insert following code below price code line:
    <?php /*add weight image on product page*/ $_weight = (float) $this->htmlescape( $_product->getweight() ); $weightimgpath = mage::getbaseurl(mage_core_model_store::url_type_media) . 'yourfoldername/'; $weightimg = 'shipping_'; if ( $_weight < 3 ) { $weightimg.'1'; } else if( $_weight >= 3 && $_weight <= 5 ) { $weightimg.'2'; } else { $weightimg.'3'; } echo '<span>shippment : <img src="' . $weightimgpath . $weightimg . '.png" /></span>'; ?>

here picture of code insert in clean magento view.phtml file:

heightimg code snippet

few things remind:

  1. you should find web developer maintain or develop website, @ least save time.

  2. you should make weight images in 1 size, otherwise website weird.

  3. you might configure put weight images, other condition show weight image , text of 'shippment :'

good luck!


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -