i copy weight
attribute value to another product attribute named general_weight
by this php code:
<?php
require_once "app/Mage.php";
Mage::app("admin");
umask();
/*
Step2: get Product Collection filter by Saleable
*/
$collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('weight');
foreach($collection as $product){
$val=$product->getWeight();
/*$product->getWeight() is not given the value then used
$product->getResource()->getAttribute('weight')->getFrontend()->getValue($product-)
*/
$product->setGeneralWeight($val);
$product->getResource()->saveAttribute($product, 'general_weight');
}
my weight
attribute has for decimals like: 90.0000
. i want to remove those decimals from general_weight
attribute and add a suffix to it like (KG
).
at the end i want 90.0000
from weight
attribute to be copied to general_weight
attribute this way: 90 KG