Entries by puneetk00

Magento 2 | How to set production mode manually

In magento 2 probubly have permission issues with server. if you are not able to set production mode by CLI command you can follow below changes. open your magento 2 root dirctory, Open file “/app/etc/evn.php” and search “‘MAGE_MODE’ =>“. you can change your mgento mode here manually. CLI command for production mode magento deploy:mode:set production […]

Add custom field for all products for order line

How to add custom fields for Order Line Items in magento     Work Flow to add custom Field to Order line Item Use this url to add to cart: Ex: http://magento.com/checkout/cart/add/?product=196&qty=2&training_location=California 1. checkout_cart_item_default.phtml::: Add the following below product name <dl class=”item-options Kiran” id=”checkout_cart_item_default”> <dt>Training Location</dt> <dd><?php echo $_item->getTrainingLocation(); ?></dd> </dl> 2. Table: sales_flat_quote_item Add […]

Magento configrable product get child product by super attribute php code

$data = array(’23’=>’7878′,’55’=>’8797′); $product = Mage::getModel(‘catalog/product’)->load(1361); $childProduct = Mage::getModel(‘catalog/product_type_configurable’)->getProductByAttributes(“$data”, $product); $product = Mage::getModel(‘catalog/product’)->load($childProduct->getId()); return $product->getFinalPrice(); Puneet Kumar Magento Developer

Magento set phtml template in cntroller with block

public function indexAction(){ $this->loadLayout(); $block = $this->getLayout()->createBlock(‘Mage_Core_Block_Template’,’PrasadSolutions_Seller_Block_Index’, array(‘template’ => ‘seller/div/verification.phtml’) ); $this->getLayout()->getBlock(‘content’)->append($block); //Release layout stream… lol… sounds fancy $this->renderLayout(); } Puneet Kumar Magento Developer

Magento create block from controller php code

$block = $this->getLayout()->createBlock(‘customer/form_login’)->setTemplate(‘persistent/customer/form/login.phtml’); $this->getResponse()->setBody($block->toHtml()); this code write in your controller you have to no write in xml layout Puneet Kumar Magento Developer

How to add custom fields for Order Line Items in magento

Work Flow to add custom Field to Order line Item Use this url to add to cart: Ex: http://magento.com/checkout/cart/add/?product=196&qty=2&training_location=California 1. checkout_cart_item_default.phtml::: Add the following below product name Training Location 2. Table: sales_flat_quote_item Add field: training_location 3. Product Detailed Page: Add training_location text field as input 4. Code -> Core -> Mage -> Sales -> Model […]

magento index rewright url create

hello this script for create your module rewrite URL, create script /* if(Mage::getModel(‘core/url_rewrite’)->loadByIdPath(“modulename/566”)){ echo Mage::getModel(‘core/url_rewrite’)->loadByIdPath(“modulename/56”)->getTargetPath(); } */ $shopurl = strtolower(preg_replace(‘/s+/’, ‘-‘, $this->getRequest()->getParam(‘shop_name’, false))); $useridshop = $model->getUserId(); // check shop url exist or not if(Mage::getModel(‘core/url_rewrite’)->loadByIdPath(“marketplace/”.$useridshop)){ $urlrewright = Mage::getModel(‘core/url_rewrite’)->loadByIdPath(“marketplace/”.$useridshop); }else{ $urlrewright = Mage::getModel(‘core/url_rewrite’); } // create or update shop url $urlrewright->setIsSystem(0) ->setStoreId(0) //->setOptions(‘RP’) ->setIdPath(‘marketplace/’.$useridshop) ->setTargetPath(‘modulename/index/index/’.$useridshop)// Put the […]

Remove precision from price of a product

Remove precision from price of a product   0 down vote favorite As I said in the title, I want to remove precision from price ( .00 ) I did these : In app/code/core/Mage/Directory/Model/Currency.php in public function format() I changed return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets); to return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets); In /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php […]