Get all saleable simple products from configurable product

The following function just gets all saleable (if saleable check is enabled in the Magento configuration) child products from a configurable product: /** * Get saleable simple products from configurable parent product * * @var Mage_Catalog_Model_Product_Type_Configurable $oParentProduct * @return array of Mage_Catalog_Model_Product(Mage_Catalog_Model_Product_Type_Simple) */ public function getAllowedProducts($oParentProduct) { $aProducts = []; $bSkipSaleableCheck = Mage::helper(‘catalog/product’)->getSkipSaleableCheck(); $oAllProducts = […]

GIT – Remove file permissions

In most cases it is useful to manage file permissions for such projects separated from GIT otherwise these permissions are forced on all machines checking out the respective repository. And that can really be a really tricky affair. To remove file permissions from repository, you can run these commands from within your project folder (where .git folder […]

Reset the password for user in Contao database

Recently I forgot the password of my Contao (https://contao.org) admin backend user. To regain control of the content management system, I had to reset the password for user in Contao database. All backend users and their credentials are stored in the Contao database in the table tl_user. The password is saved in the field password via a […]

Export or extract a certificate to or from PFX

Sometimes you have to deliver or you even get your server certificate files in the pfx file format (personal information exchange, see https://msdn.microsoft.com/en-us/library/windows/hardware/ff549703(v=vs.85).aspx), that is commonly used in Windows based environments. The following paragraphs show, how to export or extract a certificate to or from PFX. Export cert to PFX In order to export the Certificate, Private Key and any […]

Crossdomain crossite Ajax calls within a htaccess protected environment

Recently I had the challenge to implement crossdomain crossite Ajax calls within a htaccess protected environment (a crossover between Magento and Contao => both PHP-applications). But when the one application tried to call the other one via Ajax, I got the following error message in my developer  console in Chrome and Firefox and the call didn’t took place: […]

Login to a htaccess restricted area via URL

To login to a htaccess restricted area (see http://www.ask-sheldon.com/protect-folder-via-htaccess/) via URL ist pretty simple (but often forgotten): http://user:password@www.ask-sheldon.com/protected/area Please keep in mind, that in this case username and password are transmitted as plain text. There is no encryption or something like that! So anyone who plays man-in-the-middle is able to steel your credentials easily by just […]

Remove items from a collection

Sometimes you need to remove items from a collection (products f.e.) after it was loaded. The following example shows how I removed non salable product items from a collection of sibling products. The respective collection have to be inherited from Varien_Data_Collection. <?php public function getSiblingsCollection() { $oCollection = Mage::getModel(‘catalog/product’)->getCollection() ->addFieldToFilter(‘sheldon_articlenbr’, array(‘eq’ => $this->getProduct()->getData(‘sheldon_articlenbr’))) ->addFieldToFilter(‘type_id’, array(‘eq’ => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)) […]

Apache directory listing settings

Apache directory listing It is possible to let the webserver deliver a list of all files for a directory whenever a user navigates to it in the browser and there is no index file (f.e. index.html). The following Apache directory listing settings can achieve this behavior via entries in a .htaccess-file placed into the respective target folder. Enable Options […]