%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
%pwd
//app/code
%ll -a
total 10
drwxrwxr-x 5 vlad www 512 18 09:37 .
drwxrwxr-x 6 vlad www 512 29 19:30 ..
drwxrwxr-x 3 vlad www 512 29 19:30 community
drwxrwxr-x 4 vlad www 512 18 09:37 core
drwxrwxr-x 3 vlad www 512 27 02:37 local
%ll -a local
total 6
drwxrwxr-x 3 vlad www 512 27 02:37 .
drwxrwxr-x 5 vlad www 512 18 09:37 ..
drwxrwxr-x 6 vlad www 512 29 23:48 Cifrum
, , . , , Core , CoreC .
:
%ll -1aR //app/code/local/
.
..
Cifrum
//app/code/local/Cifrum:
.
..
CoreC
//app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
- . , , php|architect's Guide to Programming with Magento.
- etc, config.xml, Model, .
Model/Store.php :
<?php
/*****
Trying to rewrite Core_Model_Store
*/
// , ,
// app/code/core/Mage/Core/Model/Store.php
class Cifrum_CoreC_Model_Store extends Mage_Core_Model_Store
{
/**
*
* formatPrice without decimals, for rubles only for right now
*
*/
// ,
public function formatPrice($price, $includeContainer = true )
{
if ($ this ->getCurrentCurrency()) {
$priceReturn = $ this ->getCurrentCurrency()->format($price, array(), $includeContainer);
//Not the cleanest method but the fastest for now…
if (preg_match( '//i' , $priceReturn)) {
return $ this ->getCurrentCurrency()->format($price, array( 'precision' => 0), $includeContainer);
} else {
return $priceReturn;
}
}
return $price;
}
}
* This source code was highlighted with Source Code Highlighter .
?>
, Mage_Core_Model_Store::formatPrice() "". , ( , - ""), .
, . etc/config.xml :
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
</ depends >
</ Cifrum_CoreC >
</ modules >
< global >
< models >
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
</ corec >
</ global >
< adminhtml >
< menu ></ menu >
< acl ></ acl >
< events ></ events >
< translate ></ translate >
</ adminhtml >
< frontend >
< routers ></ routers >
< events ></ events >
< translate ></ translate >
< layout ></ layout >
</ frontend >
< default >
< config_vars >
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
-, , . . , store core .
. , , .
, app/code/etc . app/etc/modules/Cifrum_All.xml, Cifrum.
<? xml version ="1.0" ? >
< config >
< modules >
< Cifrum_CoreC >
< active > true </ active >
< codePool > local </ codePool >
</ Cifrum_CoreC >
</ modules >
</ config >
* This source code was highlighted with Source Code Highlighter .
, , . , , .
PS - , .
PPS - , .
Source: https://habr.com/ru/post/144026/
All Articles