# pwd
/<Path To Magento>/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
# ll -1aR /<Path To Magento>/app/code/local/
.
..
Cifrum
/<Path To Magento>/app/code/local/Cifrum:
.
..
CoreC
/<Path To Magento>/app/code/local/Cifrum/CoreC:
.
..
Block
Helper
Model
controllers
etc
sql
<?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 .
<?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 .
<?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 .
<? xml version ="1.0" ? >
< config >
< modules >
<!-- - , , -->
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
<!-- no dependencies -->
</ depends >
</ Cifrum_CoreC >
<!-- -->
</ modules >
< global >
< models >
<!-- -->
<!-- <rewrite> -->
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
<!-- -->
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
<!-- config values -->
</ 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 values -->
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" ? >
< config >
< modules >
<!-- - , , -->
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
<!-- no dependencies -->
</ depends >
</ Cifrum_CoreC >
<!-- -->
</ modules >
< global >
< models >
<!-- -->
<!-- <rewrite> -->
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
<!-- -->
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
<!-- config values -->
</ 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 values -->
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
<? xml version ="1.0" ? >
< config >
< modules >
<!-- - , , -->
< Cifrum_CoreC >
< version > 0.0.1 </ version >
< depends >
<!-- no dependencies -->
</ depends >
</ Cifrum_CoreC >
<!-- -->
</ modules >
< global >
< models >
<!-- -->
<!-- <rewrite> -->
< core >
< rewrite >
< store > Cifrum_CoreC_Model_Store </ store >
</ rewrite >
</ core >
<!-- -->
</ models >
< resources ></ resources >
< blocks ></ blocks >
< corec >
<!-- config values -->
</ 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 values -->
</ config_vars >
</ default >
</ config >
* This source code was highlighted with Source Code Highlighter .
<? 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 .
<? 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 .
<? 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 .
Source: https://habr.com/ru/post/63902/
All Articles