Magento: Add dynamic blocks in phtml files
To add dynamic blocks in phtml files. you can add this code to any where as you want in the phtml files like view.phtml:
<?php echo $this->getLayout()->createBlock('moduleName/blockType')->setTemplate('moduleName/templateName.phtml')->toHtml(); ?>
- moduleName: your module's name (Ex: catalog)
- blockType: the path to block file (Ex: product_view ) (Catalog/Block/Product/View.php)
Magento: How to change invoice status in Admin panel?
When creating Invoice directly from Order in admin the invoice automatically gets marked as Paid. how can it be created with the status ‘Pending’ and marked as paid later?
How to get any category’s description in Magento
First, let’s talk about how to get category by category id in Magento.
It’s easy to get category by id, just change the number in load() method.
Then this is the dsecription:
You can change the description in Catelog->Category in the backend, and you can easily get other attributes just change the getDescription() method.
Adding Parameters To A URL in PHP
This article shows how to add query parameters to a URL in a php script. It is aimed at the beginner to intermediate level PHP programmer but developers from other languages may find some useful information here. At first this seems like a simple enough task. Starting with the url as a string, just add the new parameters to the end. Yeah, that would be nice. It turns out that there are a few conditions that make the process just a bit more difficult. It’s still not a hard problem but there are enough special cases to make it interesting.
With all the changes that Facebook is making, it’s more important than ever to get your application settings correct in order to get your fan page working correctly or ensure that your Facebook social plugins work just right.
CSS: Style links depending on file format
A short CSS snippet that changes the styling of external links, email links and links to pdf documents.
/* external links */
background: url(external.gif) no-repeat center right;
/* emails */
background: url(email.png) no-repeat center right;
/* pdfs */
background: url(pdf.png) no-repeat center right;
Problem with reindexing process for "Product flat data" indexes
Reindexing of Product flat data index gives unknown reindexing error or “Some problem with reindexing process” error message or reindexing of Product flat data index is never completed.
Attempt to reindex it via command line gives the following error message:
$ php -f shell/indexer.php -- --reindex catalog_product_flat
Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (<result 2 when explaining filename '#sql-'>, CONSTRAINT ´FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID´ FOREIGN KEY (´entity_id´) REFERENCES ´catalog_product_entity´ (´entity_id)' in lib/Zend/Db/Statement/Pdo.php:228
How to get current currency in Magento?
We know Magento support multiple currency. I have found the solution to check current currency in the Magento site frontend
To get Current Currency
<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>
If you looking for current currency symbol use :
Magento: Automated Bash Script Installer
The following SSH script will automate the process of installing Magento, with or without sample data. It will walk you through everything, and the only thing you need to setup first is the database and assign a user to the database.
You will need SSH access to use this. SSH is similar to FTP, in that it requires software that you’ll need to download in order to connect to your site. If you don’t have an SSH client, you can download PuTTY for free.
CSS: Drop Caps
Use the first-letter Pseudo-Class
The easiest way to create CSS Drop Caps is to use the first-letter pseudo-element on the element you want to have a drop cap. The problem is, this isn’t supported in all browsers. Be sure to test this in the browsers your Web site supports.
Type the following and place it in a
element at the top of your Web page: