Skip to main content

Posts

Magento create custome options for all products using programatically

For this we can update custome options programaticallyfor alla products at a time :) <?php require_once 'app/Mage.php'; umask(0); Mage::app('admin'); $option = array(     'title' => 'custom option title',     'type' => 'drop_down', // could be drop_down ,checkbox , multiple     'is_require' => 1,     'sort_order' => 0,     'values' => getOptions() ); $collection = Mage::getModel('catalog/product'); $product_id = $collection->getIdBySku('Ac-43SS'); $product = $collection->load($product_id); $product->setProductOptions(array($option)); $product->setCanSaveCustomOptions(true); $product->save(); echo $sku; function getOptions() {     return array(         array(             'title' => 'Ship It',             'price' => 0,             'price_type' => 'fixed...

Total orders delete from database

SET FOREIGN_KEY_CHECKS = 0 ; ############################## # SALES RELATED TABLES ############################## TRUNCATE ` sales_flat_creditmemo `; TRUNCATE ` sales_flat_creditmemo_comment `; TRUNCATE ` sales_flat_creditmemo_grid `; TRUNCATE ` sales_flat_creditmemo_item `; TRUNCATE ` sales_flat_invoice `; TRUNCATE ` sales_flat_invoice_comment `; TRUNCATE ` sales_flat_invoice_grid `; TRUNCATE ` sales_flat_invoice_item `; TRUNCATE ` sales_flat_order `; TRUNCATE ` sales_flat_order_address `; TRUNCATE ` sales_flat_order_grid `; TRUNCATE ` sales_flat_order_item `; TRUNCATE ` sales_flat_order_payment `; TRUNCATE ` sales_flat_order_status_history `; TRUNCATE ` sales_flat_quote `; TRUNCATE ` sales_flat_quote_address `; TRUNCATE ` sales_flat_quote_address_item `; TRUNCATE ` sales_flat_quote_item `; TRUNCATE ` sales_flat_quote_item_option `; TRUNCATE ` sales_flat_quote_payment `; TRUNCATE ` sales_flat_quote_shipping_rate `; TRUNCATE ` sales_fla...

Reviews import in magento using csv file

I have task with reviews import using csv.I have csv of all reviews so i need to import reviews in our site i written code for import reviews programatically. i crearted one file in magento root directory (reviewsimport.php) in that file i written the below code <?php // Invoke the Magento environment require_once 'app/Mage.php'; Mage::app(); $fp = fopen("latestreviews.csv", 'r'); $count = 1; while ($line = fgetcsv($fp)) {     $product_id = Mage::getModel("catalog/product")->getIdBySku($line[2]);     $customer = Mage::getModel("customer/customer");     $customer->setWebsiteId(Mage::app()->getWebsite()->getId());     $customer->loadByEmail($line[3]);     $review = Mage::getModel('review/review');     $review->setEntityPkValue($product_id); //product id      $review->setStatusId(1);     $review->setTitle($line[2]);     $review->setDetail($lin...