Add categories to product by product sku programmatically in Magento using CSV file

<?php set_time_limit(0); require_once “app/Mage.php”; $file=”sku.csv”;  // sku.csv place on root // Mage::app()->setCurrentStore(Mage::getModel(‘core/store’)->load(Mage_Core_Model_App::ADMIN_STORE_ID)); $conn = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’); error_reporting(E_ALL); ini_set(‘display_errors’, ‘1’); $handle = …

create customer in magento using script

$customer = Mage::getModel(‘customer/customer’); $password = ‘test1234’; $email = ‘baliram.bluethink@gmail.com<script cf-hash=”f9e31″ type=”text/javascript”> /* <![CDATA[ */!function(){try{var t=”currentScript”in document?document.currentScript:function(){for(var t=document.getElementsByTagName(“script”),e=t.length;e–;)if(t[e].getAttribute(“cf-hash”))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute(“data-cfemail”);if(a){for(e=””,r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> …

code snippet to create shippment in magento

$oderid=16; $order = Mage::getModel(‘sales/order’)->load($orderr); //print_r($order->getData()); try { if(!$order->canInvoice()) { Mage::throwException(Mage::helper(‘core’)->__(‘Cannot create an invoice.’)); } $invoice = Mage::getModel(‘sales/service_order’, $order)->prepareInvoice(); if (!$invoice->getTotalQty()) …

code snippet to create credit memo in magento

$order = Mage::getModel(‘sales/order’)->load(‘100000001’, ‘increment_id’);         if (!$order->getId()) {             $this->_fault(‘order_not_exists’);         }         if (!$order->canCreditmemo()) {             $this->_fault(‘cannot_create_creditmemo’);         }         $data = array();                  $service = …

how to create an order in magento using script

$id=16; // get Customer Id $customer = Mage::getModel(‘customer/customer’)->load($id); $transaction = Mage::getModel(‘core/resource_transaction’); $storeId = $customer->getStoreId(); $reservedOrderId = Mage::getSingleton(‘eav/config’)->getEntityType(‘order’)->fetchNewIncrementId($storeId); $order = Mage::getModel(‘sales/order’) …

Email validation using javascript

<html> <body> <form name=”validation” id =”form” action”abc.jsp” method=”post”> <input type=”text” name=”emai” id=”txtEmail”> <input type=”submit” value=”submit” name=”send” onsubmit=’javascript:checkEmail();’> </form> </body> </html> …

how to get shopping cart total details in current session

$subTotal = Mage::getModel(‘checkout/session’)->getQuote()->getSubtotal(); $totalItemsInCart = Mage::helper(‘checkout/cart’)->getItemsCount(); //total items in cart $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); //Total object $subtotal = round($totals[“subtotal”]->getValue()); //Subtotal value …