Doctrine Console Commands
Example doctrine console command: php vendor/bin/doctrine orm:generate-entities –help Available commands: dbal:import Import SQL file(s) directly to Database. dbal:run-sql Executes arbitrary SQL directly from the command…
PHP development
Example doctrine console command: php vendor/bin/doctrine orm:generate-entities –help Available commands: dbal:import Import SQL file(s) directly to Database. dbal:run-sql Executes arbitrary SQL directly from the command…
The dump function dumps information about a template variable. It can be used as an alternative to var_dump or print_r from php. This is mostly…
Zend Framework 1 – trace sql errors and exceptions and put them in a log file. Add the next code in the ErrorController.php: <?php class…
Get category image: <?php $_category = $this->getCurrentCategory(); $_imageUrl = $this->getImageUrl(); ?> Get category thumbnail: <?php $_category = $this->getCurrentCategory(); $_imageUrl = $this->getThumbnail(); ?>
PHP simple SOAP sample SOAP server file (soapserver.php): <?php // Set a function in SOAP server file function hello($someone) { return “Hello ” . $someone…
Magento get products childs for a configurable product // $currentProduct = $this->getProduct(); $configurable_products = Mage::getModel(‘catalog/product_type_configurable’)->setProduct($currentProduct); $products_collection = $configurable_products->getUsedProductCollection()->addAttributeToSelect(‘*’)->addFilterByRequiredOptions(); foreach($products_collection as $_product){ echo $_product->getId() . “:…
In file ‘list.phtml’ file change the <button> line near line 108 from this: <?php if($_product->isSaleable()): ?> <button class=”form-button” onclick=”setLocation(‘<?php echo $this->getAddToCartUrl($_product) ?<‘)”>>span> <?php echo $this->__(‘Add…
Include a static block into a phtml file: echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘block_identifier’)->toHtml();
Magento database connection write mode: $db = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’); Magento database connection read mode: $db = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’); Query model $result = $db->query(“SELECT * FROM tablename”); if…
Custom block (for CMS pages): {{block type=”core/template” name=”template_name” template=”mydir/mytemplate.phtml” }}