Collection setOrder
Posted Over 2 years ago. Visible to the public.
public function setOrderByVaccDates($boxId, $direction = self::SORT_ORDER_DESC)
{
$case = 'CASE WHEN box_id = ' . $boxId . ' THEN vacc_date ELSE vacc_second_date END';
$this->setOrder($case, $direction);
return $this;
}
ORDER BY
CASE
WHEN box_id = 376 THEN vacc_date ELSE vacc_second_date
END
DESC
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 ...
Filter EAV collection
condA AND (cond1 OR cond2 OR cond3)
$cincId = $session->getCustomerId();
$attributes = array(
array('attribute'=>'mc_by', 'eq'=>$clinicId),
array('attribute'=>'mc_lb_by', 'eq'=>$clinicId),
array('attribute'=>'mc...
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....
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...
validation.js
/*
* Really easy field validation with Prototype
* http://tetlaw.id.au/view/javascript/really-easy-field-validation
* Andrew Tetlaw
* Version 1.5.4.1 (2007-01-05)
*
* Copyright (c) 2007 Andrew Tetlaw
* Permission is hereby granted, free of c...
addFieldToFilter
OR
$collection->addFieldToFilter('field_name',
[
['eq' => 'value1'],
['eq' => 'value2']
]
);
// same as
$collection->addFieldToFilter('field_name', ['value1', 'value2']);
Filter for X or Y
$colle...
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_...
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...
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($...
Posted by kiatng to OpenMage (2021-09-06 08:06)