Exception Try Catch Block in PHP7
final public function call($method, $args = [])
{
try {
return $this->_apiCall($method, $args);
} catch (Custom_Exception $e) {
throw $e;
} catch (Throwable $e) {
throw new Custom_Exception('Unexpected error: '.$e->getMessage(), $e->getCode(), $e);
}
}
Related cards:
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...
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...
Add dynamic block contents in category page
In backend > Catalog > Manage Categories, we can configure a category page and put it on the main menu. The page contents are rendered in
app\design\frontend\base\default\template\catalog\category\view.phtml
If we want to render an HTML tab...
How to redirect in controller by throwing an exception
This whole class Mage_Core_Controller_Varien_Exception
has only one reference in the core, see search result.
In the catch
, there is ...
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...
JOINS in Zend_Db_Select
OM uses Zend Version 1.12.16.
Adding Another Table to the Query with JOIN
Many useful queries involve using a JOIN to combine rows from multiple tables. You can a...
Whitelist Custom Block For Calling in Static Block with Double Curly Brackets
When a block directive, double curly brackets: {{block type="module/block"}} is called in the static block, it is necessary to whitelist the block type in
admin > System > Permissions > Block
. Otherwise, it will not render.
Alternatively, the ...
Uncaught TypeError: imagecopymerge(): Argument #9 ($pct) must be of type int, string given in .../lib/Varien/Image/Adapter/Gd2.php:570
Uncaught TypeError: imagecopymerge(): Argument #9 ($pct) must be of type int, string given in /.../lib/Varien/Image/Adapter/Gd2.php:570
Stack trace:
#0 /.../lib/Varien/Image/Adapter/Gd2.php(570): imagecopymerge(Object(GdImage), Object(GdImage), 0,...
Warning: Invalid argument supplied for foreach() in lib/Zend/Locale/Format.php on line 853
PHP Version 7.4.7 OpenMage 1.9.4.5
if ($day !== false) {
$parse[$day] = 'd';
if (!empty($options['locale']) && ($options['locale'] !== 'root') &&
(!is_object($options['locale']) || ((string) $options['locale'] !== 'root')...