Magento Stores
Posted Over 9 years ago. Visible to the public.
Load Store by Store Code
$store = Mage::getModel('core/store')->load('store_code');
// or
$store = Mage::app()->getStore('store_code');
Get Store URL
$store->getBaseUrl();
Get Store Secure URL
$store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true);
Last edit
Over 9 years ago
kiatng
Related cards:
How to use cache in OpenMage / Magento 1.x to speed things up
Mechanism: cache in model
First, save the cache
// app\code\core\Mage\Core\Model\App.php Mage_Core_Model_App
/**
* Saving cache data
*
* @param mixed $data
* @param string $id
* @param array $tags
* @param null|false|int ...
Add new input type in product custom options
custom module productcoption
config.xml
<config>
<modules>
<Somemod_ProductCoption>
<version>0.0.1</version>
</Somemod_ProductCoption>
</modules>
<global>
<resources>
<productcopti...
Grid Column Options
Column Types
Take a look at Mage_Adminhtml_Block_Widget_Grid_Column::_getRendererByType()
to dive into the different column types:
app\code\core\Mage\Adminhtml\Block\Widget\Grid\Column\Renderer\Abstract.php
- date
- datetime
- number
1....
Form Field
A sample of different options to add field in Mage_Adminhtml_Block_Widget_Form
Ref Varien_Data_Form_Element_Abstract
lib\Varien\Data\Form\Element\Abstract.php
Add Suffix to Element Names
$form = new Varien_Data_Form(['field_name_...
FIle Download
Generate the URL:
/**
* For file and image field, get the file URL
*
* @see Mage_Customer_Model_Attribute_Data_File
* @return string
*/
public function getFileUrl()
{
return $this->getUrl('exte...
Controller Action Response
json response
public function completeAction()
{
$orderId = $this->getRequest()->getParam('order_id', false);
$info['order_id'] = 0;
if ($orderId) {
$order = Mage::getModel('patron/order')->load($...
Dataflow Import/Export Profiles
Import Sample Actions XML:
<action type="dataflow/convert_adapter_io" method="load">
<var name="type">file</var>
<var name="path">var/import</var>
<var name="filename"><![CDATA[filename.csv]]></var>
<var name="format"><![CDAT...
nginx config
See production grade nginx and docker config here.
Some notes on this:
- the PCI work was trial and error, we did set up, the external audit did penetration/probe testing, we adjusted settings...
Adminhtml JSON Response Body
HTML
public function visibleProductsAction()
{
$this->getResponse()->setBody(
$this->getLayout()->createBlock('module/adminhtml_block_type')->toHtml()
);
}
Generic Block:
$block = $this->getLayout()->createBloc...
Posted by kiatng to OpenMage (2014-10-24 03:34)