Magento: Running script out side Magento Folder and Updating Project Database

Magento: Running script out side Magento Folder and Updating Project Database

Magento: Running script out side Magento Folder and Updating Project Database

Place this script ‘image.php’ out side magento folder and run this with http://yoursite/image.php, this will update all product images if there is no small or thumbnail image.
It will make first image as thumb and small image.

An example to run script out side magento folder.

require ‘app/Mage.php’;
Mage::app();

$products = Mage::getModel(‘catalog/product’)->getCollection()->addAttributeToSelect(‘*’);
foreach ($products as $product) {
 if (!$product->hasImage()) continue;
 if (!$product->hasSmallImage()) $product->setSmallImage($product->getImage());
 if (!$product->hasThumbnail()) $product->setThumbnail($product->getImage());
 $product->save();
}

Magento: Showing Breadcrumbs Anywhere in Magento

In Magento, by default there is a reference place where breadcrumbs get showed, that is just above the content reference! But, sometimes you need to show the breadcrumbs twice! above and below the content. Or sometimes you just need to show the breadcrumbs inside the content, due to some designing issue! I’ve gone through these situation a lot, and thought why not post a solution in my blog?
Here’s the “magic code” for breadcrumbs to show anywhere in Magento

<?php  echo $this->getLayout()->getBlock("breadcrumbs")->toHtml()?>

Its very simple, it just gets the block breadcrumbs defined in page.xml and echoes it as html.
Happy coding!

Magento: Replace Price Difference with Actual Price in Magento Configurable Product Options

This is performed by javascript. You need to modify the method getOptionLabel in js/varien/configurable.js (this is Magento 1.5.1.0, your milage may vary depending on the version you’re using).

This method receives the option and the price difference to be applied. If you want to just show the absolute price of the different options, you need to calculate them yourself, using the absolute base value of the configurable product and the absolute difference of the option.
(more…)

Magento: Rating showing twice on product pages

We came across an issue recently, where the customer’s product pages review section was showing the rating stars twice. We tried to locate the issue, but nothing seemed to work. Finally found out the fix .

Just goto the phpmyadmin and run this SQL query,

	
TRUNCATE  `rating_option_vote` ;
TRUNCATE  `rating_option_vote_aggregated` ;

Magento: How to remove discount coupon code?

Magento offers a built in coupon code feature to provide shopping cart customers with discounts when shopping on their ecommerce website. You can post discount codes in emails, blogs and social networks to generate more traffic and entice paying customers to your ecommerce website. But often, website owners don’t want to offer discount codes on their shopping cart. Fortunately for ecommerce web designers, it is quite easy to disable the discount coupon code function on a Magento shopping cart website.
(more…)

Magento: How to remove Estimate Shipping and Tax?

Magento offers a built in Estimate Shipping and Tax feature to provide shopping cart customers with realtime feedback of tax and shipping estimation when shopping on an ecommerce website. But often, website owners don’t want to display the Estimate Shipping and Tax function on their shopping cart website. For example, some shopping cart website owners will offer free shipping or flat rate shipping, which makes shipping estimation irrelevant, not to mention confusing and distracting to ecommerce customers. Fortunately for ecommerce web designers, it is quite easy to disable the Estimate Shipping and Tax function on a Magento shopping cart website.
(more…)

Magento: How to dynamically get product image URL and page title on Facebook when sharing a product?

Add thew following code just before the tag

 <?php if (Mage::registry('current_product')) : ?>
<meta property="og:image" content="<?php echo Mage::helper('catalog/image')->init(Mage::registry('current_product'), 'small_image')->resize(100,100);?>" />
<meta property="og:title" content="<?php echo Mage::registry('current_product')->getName();?>" /> 
<?php endif;?>

Magento: How to get all Store Ids, codes, names & current url in Magento?

$allStores = Mage::app()->getStores();
foreach ($allStores as $_eachStoreId => $val)
{
$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
$_currentUrl = Mage::app()->getStore($_eachStoreId)->getCurrentUrl();
echo $_storeId;
echo $_storeCode;
echo $_storeName;
echo $_currentUrl;
}
Page 3 of 81234567»

Pin It on Pinterest