Skip to main content
6 votes
Accepted

How to get Cookies already set on the browser

You can try the below code to get cookie. <?php namespace Training\Rememberme\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Config\ScopeConfigInterface; use ...
Jjo's user avatar
  • 1,168
5 votes

Email template 'custom_mail_template' is not defined

I face the same problem when I use a custom email template and its resolved by the following changes. If you check your system.xml file you can find that you path for system config for email template ...
Nikunj Rawat's user avatar
5 votes

retrieving collection in magento-2?

I hope this might help you $orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Grid\Collection'); $orderCollection->getSelect()->joinLeft( ['...
Abhishek Panchal's user avatar
4 votes

How should I get the image path?

Mage::getModel('catalog/product_media_config')->getMediaUrl( $product->getImage());
Shahab Hameed's user avatar
4 votes
Accepted

How should I get the image path?

You can take it from the helper class Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(100);
Priyank's user avatar
  • 7,712
4 votes
Accepted

Magento 1 end of life - where can I download Magento 1.5.1 patch to run PHP 5.4?

UPDATE Magento has removed the official links but there is a project on github where all releases of magento can be found. The link is https://github.com/OpenMage/magento-mirror/releases Currently the ...
Zenel Rrushi's user avatar
4 votes

Magento 1 end of life - where can I download Magento 1.5.1 patch to run PHP 5.4?

Check github repo from OpenMage – https://github.com/OpenMage/magento-mirror/releases. It contain releases starting from 1.1.1 up to 1.9.4.5. Security patches can be found in Magento patches mirror ...
Sergey Korzhov's user avatar
3 votes

RegEx in PHP file

I reckon you should use Zend_Validate_Regex in that case. You could do: $validate = new Zend_Validate_Regex("/(?=.*[\d])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&])[0-9a-zA-Z!@#$%^&]{10,16}/"); if ...
Raphael at Digital Pianism's user avatar
3 votes

Is there any library for this error or something else?

you should have this: require_once('app/Mage.php'); $app = Mage::app(); Mage::helper('catalog/output'); Basically the $this->helper is calling the function that is contained inside ...
Nguyễn Hồng Quân's user avatar
3 votes
Accepted

Where is the Magento 1.x PHP 5.4 patch?

How about https://magento.com/tech-resources/download#download252 :) Sorry for one line answer (have to write something)
sv3n's user avatar
  • 11.7k
2 votes

my table is not installing in Magento 2

Some time there may an entry for you module in app/etc/config.php with value 0. And if you run the command bin/magento setup:upgrade then it will not upgrade your plugin. Change the vaue to 1 ...
Manish's user avatar
  • 3,114
2 votes

How to call php if/else statement if value empty

You can achieve this in one line with a ternary operator $_commissionGroupCode = ($_voucher ? 'VOUCHER' : 'DEFAULT');
TheNightmare's user avatar
2 votes

How to turn off Bread Crumb

If you want to remove breadcrumbs from site add below code in your local.xml file in current theme <?xml version="1.0"?> <layout version="0.1.0"> <default> <reference ...
Minesh Patel's user avatar
  • 2,193
2 votes
Accepted

How to turn off Bread Crumb

Go To Admin-->System --> Web --> Default Pages --> Show Breadcrumbs for CMS Pages to Set "NO".
Mage Rider's user avatar
2 votes
Accepted

RegEx in PHP file

if (strlen($password) && !Zend_Validate::is($password, 'Regex', array('/(?=.*[\d])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&])[0-9a-zA-Z!@#$%^&]{10,16}/')) { $errors[] = Mage::helper('...
Marius's user avatar
  • 198k
2 votes
Accepted

What is the attribute to check if products are sold in incrememts?

Try it like this: <?php if($_product->getStockItem()->getQtyIncrements()): ?> <p><?php echo $this->__('Only available in box quantities');?></p> <?php else: ?...
Marius's user avatar
  • 198k
2 votes
Accepted

How can i redirect from 1 page to product detail page?

just use below code $productCollection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('name', array('like' => '%hp%')) ->addAttributeToSelect('*'...
Gopal Patel's user avatar
  • 3,139
2 votes
Accepted

Magento 1 - Save Collection Without Foreach

After doing some research into this, I discovered that the best way to do this is like the following. Please note that the walk iterator is essentially the same thing as a foreach loop, however the ...
djames's user avatar
  • 387
2 votes

How to get the css file path in magento?

Replace Code With: <link rel="stylesheet" href="<?php echo $this->getSkinUrl(); ?>css/yourCssfile.css" type="text/css" />
Harshil Parekh's user avatar
2 votes
Accepted

Magento 2 : Error While Installing

For upgrading PHP version you can go through following steps Run the following command if you are using linux: For PHP 5.5, PHP 5.6 and PHP 7.0: sudo apt-add-repository ppa:ondrej/php For PHP 5.4 (...
Bhupendra Jadeja's user avatar
2 votes
Accepted

Not able to override phtml file

In argument (default.xml) you have specify your new phtml file. But you have given original phtml file. Instead of Magento_Theme you have to use Netsmartz_Welcomemessage::theme/messages.phtml <...
Agnes's user avatar
  • 787
2 votes
Accepted

Fetch array with PHP MySQL query

Try this $query = "SELECT $userTable.value, SUM(DISTINCT(base_order_total)) FROM $salesTable INNER JOIN $userTable ON $salesTable.vendor_id=$userTable.entity_id WHERE payment_state='2' GROUP BY ...
Dinesh Yadav's user avatar
  • 6,465
1 vote

How to Get top 5 Subcategories?

try below code. <?php $newCategory = Mage::getModel('catalog/category')->getCollection()->addAttributeToFilter('parent_id',array('eq' => $newSubCategoryId))->setPageSize(5); ?> ...
Qaisar Satti's user avatar
  • 32.5k
1 vote

Magento 2 js not loading after installing a new theme

Run following 2 commands, I am sure issue will be resolved: php bin/magento setup:upgrade php bin/magento setup:di:compile
Kamlesh Yaduwanshi's user avatar
1 vote

Right path of an image?

Try this code for getting original path $productMediaConfig = Mage::getModel('catalog/product_media_config'); $baseImageUrl = $productMediaConfig->getMediaUrl($product->getImage()); $...
Fme Extensions's user avatar
1 vote
Accepted

Uncaught TypeError: Argument 2 passed to Mage::dispatchEvent() must be of the type array

This line Mage::dispatchEvent('testimonial_save_before', $model); Should be Mage::dispatchEvent('testimonial_save_before', array('testimonial' => $model)); And you need to modify the ...
Marius's user avatar
  • 198k
1 vote

Is there any library for this error or something else?

I think you are creating a stand alone script. so you can try below things to work require_once("$Magento_Root_DIR/app/Mage.php"); // include Mage.php file $app = Mage::app(); //init Mage::app() $...
Murtuza Zabuawala's user avatar
1 vote

How to turn off Bread Crumb

Method 1 If you want to remove the Breadcrumbs from all dynamic pages, use the code below in local.xml: <?xml version="1.0"?> <layout version="0.1.0"> <default> ...
Nikunj Vadariya's user avatar
1 vote

get attribute option value in magento 2.1 using helper in module data.php

You can use this in your helper class :: public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\Product\Attribute\Repository ...
Ashish Jagnani's user avatar
1 vote
Accepted

How to call php if/else statement if value empty

You can do it like this: $_commissionGroupCode = (!$_voucher ? "DEFAULT" : "VOUCHER");
Raphael at Digital Pianism's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible