Skip to main content

Posts

Showing posts from July, 2018

Redirecting functions in magento frontend controller

There are three redirecting functions available in frontend controller which are: redirect() _redirectUrl() _redirectReferer() _redirect('frontName/controllerName/actionName/param1/param2') is used for internal redirection. _redirectUrl($fullUrl) is used for external redirection. _redirectReferer() is used to redirect to the referer url.

Limit the size of a product image upload (dimensions) set default limits

If you  trying to change default uploading image sizes like minimum size accept is 500x500 and the maximum size allowed is 1000x1000 . Need to check validations open the file in your magento folder  app\code\core\Mage\Catalog\Helper\Image.php and search for  below function public function validateUploadFile($filePath) { around the 636 line public function validateUploadFile($filePath) {             $maxDimension = Mage::getStoreConfig(self::XML_NODE_PRODUCT_MAX_DIMENSION);             $imageInfo = getimagesize($filePath);             if (!$imageInfo) {                 Mage::throwException($this->__('Disallowed file type.'));            }         if ($imageInfo[0] > $maxDimension || $imageInfo[1] > $maxDimension) {             Mage::throwException($this->__('Disalollowed file format.'));         }         $_processor = new Varien_Image($filePath);         return $_processor->getMimeType() !== null;     } Change to public function vali

Magento Debug HEADERS ALREADY SENT error

When you  receiving the following error in  system.log file: app\code\core\Mage\Core\Controller\Response\Http.php:44  [1] \www.pawan.com\lib\Zend\Controller\Response\Abstract.php:727  [2]  \www.pawan.com\app\code\core\Mage\Core\Controller\Response\Http.php:75  [3]  \www.pawan.com\app\code\core\Mage\Core\Controller\Varien\Front.php:188  [4]  \www.pawan.com\app\code\core\Mage\Core\Model\App.php:304  [5]  \www.pawan.com\app\Mage.php:596  [6]  \www.pawan.com\index.php:81 if you have no idea what file is causing this. Here is the steps to debug. That error is thrown from Mage_Core_Controller_Response_Http -> sendHeaders(). This function calls the super class function that actually does the check to see whether or not headers have already been sent, Zend_Controller_Response_Abstract -> canSendHeaders(). The Zend_Controller_Response_Abstract class handles, among other things, sending response headers and tracking the last time the headers were sent (and from wha

magento 2 best seller product display based on current category and subcategories

Magento 2 getting best seller based on category wise displaying i have done below for that to implement this functionality it is working fine for me. step 1 create block file in our module folder <?php namespace Pawan\Bestseller\Block; use Magento\Catalog\Api\CategoryRepositoryInterface; class Bestsellercategory extends \Magento\Catalog\Block\Product\ListProduct {     /**      * Product collection model      *      * @var Magento\Catalog\Model\Resource\Product\Collection      */     protected $_collection;     /**      * Product collection model      *      * @var Magento\Catalog\Model\Resource\Product\Collection      */     protected $_productCollection;     /**      * Image helper      *      * @var Magento\Catalog\Helper\Image      */     protected $_imageHelper;     /**      * Catalog Layer      *      * @var \Magento\Catalog\Model\Layer\Resolver      */     protected $_catalogLayer;     /**      * @var \Magento\Framework\Data\Helper\PostHe

Magento multiple order on one checkout or order splitting(Vendor wise order splitting)

I had to split orders based on the vendor/seller selling that product. Like, for example, if someone orders Product1, Product2 and Product3, where Product1 and Product2 are sold by Vendor1 and Product3 is sold by Vendor2. Then, 2 orders with different Order Ids must be created where the Order1 will have details regarding the order of Product1 and Product2 and the Order2 will have the details regarding the order of Product3. I changed the saveOrder() function. It now splits the order by fallowing ways. 1.Create config file or you can use existing module configfile. <?xml version="1.0"?> <config>     <modules>         <Pawan_Splitorder>             <version>0.1.0</version>         </Pawan_Splitorder>     </modules>     <global>         <helpers>             <splitorder>                 <class>Pawan_Splitorder_Helper</class>             </splitorder>         </helpers&