php - how to get all product collection using product name like and price ascending in magento? -


i have different affiliate products same name in database, how can price comparison of products in product details page? can me shortest way?

i tried this

$product_id = mage::registry('current_product')->getid();  $obj = mage::getmodel('catalog/product');  $_product = $obj->load($product_id);  $collection = mage::getmodel('catalog/product')->getcollection();   $collection->addattributetofilter('name', ['like' => $_product->getname().'%']); 

that seems way go me, simplify code just:

$_product = mage::registry('current_product'); $_collection = $_product->getcollection()->addattributetofilter('name', ['like' => $_product->getname() . '%']); 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -