"рдХреБрдЯрд┐рд▓" рдХреИрд╕реЗ Magento рдореЗрдВ рдХреАрдордд рд╕реЗ рд╕реЗрдВрдЯ рдХреЗ рдкреНрд░рджрд░реНрд╢рди рдХреЛ рд╣рдЯрд╛ рджреЗрдВ, рдпрд╛ рдорд╛рдирдХ рдХрдХреНрд╖рд╛рдУрдВ рдХреЛ рдлрд┐рд░ рд╕реЗ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░рдиреЗ рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рдХреБрдЫ рд╢рдмреНрдж

рдореИрдВ рдПрдХ рдХрд╛рдордХрд╛рдЬреА (рд╣рд╛рд▓рд╛рдВрдХрд┐, рдХреБрдЫ рд╣рдж рддрдХ рдХреБрдЯрд┐рд▓) рд╕рдорд╛рдзрд╛рди рд╕рд╛рдЭрд╛ рдХрд░рдирд╛ рдЪрд╛рд╣рддрд╛ рд╣реВрдВ, рдпрджрд┐ рдЖрд╡рд╢реНрдпрдХ рд╣реЛ, рддреЛ рдХреАрдорддреЛрдВ рдореЗрдВ рд╕реЗрдВрдЯ рдХреЗ рдкреНрд░рджрд░реНрд╢рди рдХреЛ рд╣рдЯрд╛рдиреЗ рдХреЗ рд▓рд┐рдПред рдПрдХ рдмрд╛рд░ рдлрд┐рд░, рдпрд╣ рдХреЗрд╡рд▓ рдкреНрд░рджрд░реНрд╢рди рдкреНрд░рд╛рд░реВрдк рдХреЛ рдмрджрд▓рддрд╛ рд╣реИ, рд╡рд╛рд╕реНрддрд╡рд┐рдХ рдХреАрдорддреЛрдВ рдореЗрдВ рдмрджрд▓рд╛рд╡ рдирд╣реАрдВ рд╣реЛрддрд╛ рд╣реИ, рдФрд░ рдпрд╣ рдЧреЛрд▓ рдирд╣реАрдВ рд╣реИ - рджрд╕рд╡реАрдВ рдмрд╕ рдЦрд╛рд░рд┐рдЬ рдХрд░ рджреА рдЬрд╛рддреА рд╣реИ, рдЗрд╕рд▓рд┐рдП рдпрд╣ рдХрд╛рдлреА рд╕рдВрднрд╡ рд╣реИ рдХрд┐ рдЯреЛрдХрд░реА рдореЗрдВ рдорд╛рд▓ рдХреА рд▓рд╛рдЧрдд рдХрд╛ рд╕реНрдкрд╖реНрдЯ рдпреЛрдЧ рдЖрдкрдХреЗ рджреНрд╡рд╛рд░рд╛ рдПрдХ рдХреЙрд▓рдо рдореЗрдВ рд╕рдм рдХреБрдЫ рдЬреЛрдбрд╝рдиреЗ рд╡рд╛рд▓реА рд╡рд╛рд╕реНрддрд╡рд┐рдХ рд░рд╛рд╢рд┐ рд╕реЗ рднрд┐рдиреНрди рд╣реЛрдЧрд╛ред рдЖрдпрд╛рдд рдпрд╛ рдореИрдиреНрдпреБрдЕрд▓ рдореВрд▓реНрдп рдкрд░рд┐рд╡рд░реНрддрди рдХреЗ рджреМрд░рд╛рди рдорд╛рд▓ рдХреА рдХреАрдорддреЛрдВ рдореЗрдВ рд╕реЗрдВрдЯ рдХреА рдЕрдиреБрдкрд╕реНрдерд┐рддрд┐ рдХреЛ рдирд┐рдпрдВрддреНрд░рд┐рдд рдХрд░рдХреЗ рдЗрд╕реЗ рд░реЛрдХрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИред

рдореБрдЭреЗ рддреБрд░рдВрдд рдпрд╣ рдХрд╣рдирд╛ рд╣реЛрдЧрд╛ рдХрд┐ рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ рд╕рдорд╛рдзрд╛рди рдореЗрд░рд╛ рдирд╣реАрдВ рд╣реИ, рдореИрдВрдиреЗ рдЗрд╕реЗ рдпрд╣рд╛рдВ рдЬрд╛рд╕реВрд╕реА рдХреА рдФрд░ рдЗрд╕реЗ рд╕рд╣реА рдврдВрдЧ рд╕реЗ рдЬрд╛рд░реА рдХрд░рдиреЗ рдХрд╛ рдлреИрд╕рд▓рд╛ рдХрд┐рдпрд╛ред

рдЕрдкрдиреЗ рдСрдирд▓рд╛рдЗрди рд╕реНрдЯреЛрд░ рдЗрдВрдЯрд░рдлрд╝реЗрд╕ рдХреЛ рд╡рд┐рдХрд╕рд┐рдд рдХрд░рддреЗ рд╕рдордп, рдореБрдЭреЗ рди рдХреЗрд╡рд▓ рд╕рд╣реА рдбрд┐рдЬрд╝рд╛рдЗрди рдФрд░ рддрд░реНрдХ рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдХрд╛рд░реНрдп рдХрд╛ рд╕рд╛рдордирд╛ рдХрд░рдирд╛ рдкрдбрд╝рд╛, рдмрд▓реНрдХрд┐ рдЕрдЧрд▓реЗ рд╕рдВрд╕реНрдХрд░рдгреЛрдВ рдХреЗ рд▓рд┐рдП рдЗрдВрдЬрди рдХрд╛ рдПрдХ рдкрд░реЗрд╢рд╛рдиреА-рдореБрдХреНрдд рдЕрджреНрдпрддрди рд╕реБрдирд┐рд╢реНрдЪрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП, рдЗрд╕рд▓рд┐рдП рдореИрдВрдиреЗ рддреБрд░рдВрдд рд╕рдВрдкрд╛рджрди рд╕рд┐рд╕реНрдЯрдо рдлрд╝рд╛рдЗрд▓реЛрдВ рдХреЛ рдмрд╛рд╣рд░ рдХрд░ рджрд┐рдпрд╛ред рд╣рд╛рд▓рд╛рдВрдХрд┐, Magento рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рдПрдХреНрд╕рдЯреЗрдВрд╢рди рд╡рд┐рдХрд╕рд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдЙрддреНрдХреГрд╖реНрдЯ рдЙрдкрдХрд░рдг рдкреНрд░рджрд╛рди рдХрд░рддрд╛ рд╣реИ, рдЬрд┐рд╕рдореЗрдВ рдорд╛рдирдХ рдХрд╛рд░реНрдпрдХреНрд╖рдорддрд╛ рдХреЛ рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рд╕рд╛рде рдмрджрд▓рдиреЗ рдХреА рдХреНрд╖рдорддрд╛ рднреА рд╢рд╛рдорд┐рд▓ рд╣реИред рдпрд╣реА рд╣рдо рдХрд░реЗрдВрдЧреЗред

рддреЛ, рд╣рдореЗрдВ рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдХрд░рдиреЗ рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рд╣реИ:
- рд╕реНрд╡рд░реВрдкрд┐рдд рдореВрд▓реНрдп рдкреНрд░рджрд░реНрд╢рд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдЬрд┐рдореНрдореЗрджрд╛рд░ рд╡рд░реНрдЧ рдХреЛ рдлрд┐рд░ рд╕реЗ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░реЗрдВ;
- рдПрдХ рдореЙрдбреНрдпреВрд▓ рдмрдирд╛рдПрдВ рдЬрд┐рд╕рдореЗрдВ рдпрд╣ рд╡рд░реНрдЧ рд╣реЛрдЧрд╛;
- рдореЙрдбреНрдпреВрд▓ рдХреЛ рдХреЙрдиреНрдлрд╝рд┐рдЧрд░ рдХрд░реЗрдВ рддрд╛рдХрд┐ рдкреБрдирд░реНрдирд┐рд░реНрдзрд╛рд░рд┐рдд рд╡рд░реНрдЧ рдЙрди рдорд╛рдорд▓реЛрдВ рдореЗрдВ рдХрд╣рд╛ рдЬрд╛рддрд╛ рд╣реИ рдЬрд┐рд╕рдореЗрдВ рдореВрд▓ рд╡рд░реНрдЧ рдкрд╣рд▓реЗ рд╕рдХреНрд░рд┐рдп рдерд╛;
- рд╕рд┐рд╕реНрдЯрдо рдореЗрдВ рдПрдХ рдирдпрд╛ рдореЙрдбреНрдпреВрд▓ рд╕рдХреНрд░рд┐рдп рдХрд░реЗрдВред

рджрд┐рдП рдЧрдП рд╕рднреА рдкрде рдЙрд╕ рдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛ рдХреЗ рд╕рд╛рдкреЗрдХреНрд╖ рд╣реИрдВ рдЬрд┐рд╕рдореЗрдВ Magento рд╕реНрдерд╛рдкрд┐рдд рд╣реИред

рдЬреИрд╕рд╛ рдХрд┐ рдореИрдВрдиреЗ рдХрд╣рд╛, Magento рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рдореЙрдбреНрдпреВрд▓ рд╡рд┐рдХрд╕рд┐рдд рдХрд░рдиреЗ рдФрд░ рдмреБрдирд┐рдпрд╛рджреА рдХрд╛рд░реНрдпрдХреНрд╖рдорддрд╛ рдХрд╛ рд╡рд┐рд╕реНрддрд╛рд░ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдЕрдЪреНрдЫреЗ рдЕрд╡рд╕рд░ рдкреНрд░рд╕реНрддреБрдд рдХрд░рддрд╛ рд╣реИред рд╕рд┐рд╕реНрдЯрдо рдХреЗ рдХрд╛рдордХрд╛рдЬреА рдХреЛрдб рдХрд╛ рдореБрдЦреНрдп рд╣рд┐рд╕реНрд╕рд╛ (рдкреБрд╕реНрддрдХрд╛рд▓рдпреЛрдВ рдФрд░ рдЪреМрдЦрдЯреЛрдВ рдХреЗ рдЕрдкрд╡рд╛рдж рдХреЗ рд╕рд╛рде, рдЬрд┐рд╕ рдкрд░ рдпрд╣ рд▓рд┐рдЦрд╛ рдЧрдпрд╛ рд╣реИ) рдРрдк рдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛ рдореЗрдВ рд╕реНрдерд┐рдд рд╣реИред рдпрджрд┐ рд╣рдо рдЕрдВрджрд░ рджреЗрдЦреЗрдВ, рддреЛ рд╣рдо рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рд╕рд╛рдордЧреНрд░реА рджреЗрдЦреЗрдВрдЧреЗ:

рдПрдкреНрд▓рд┐рдХреЗрд╢рди
| ----- Mage.php
| ----- рдХреЛрдб
| ----- рдбрд┐рдЬрд╛рдЗрди
| ----- рдЖрджрд┐
| ----- рд╕реНрдерд╛рдиреАрдп

Mage.php - рдПрдХ рдореЙрдбреНрдпреВрд▓ рдЬреЛ рд╕рд┐рд╕реНрдЯрдо рдХреЗ рдореБрдЦреНрдп рд╡рд░реНрдЧ-рд╣рдм рдХрд╛ рд╡рд░реНрдгрди рдХрд░рддрд╛ рд╣реИ - Mage
рдХреЛрдб - рд╕рднреА рдХреЛрдб
рдбрд┐рдЬрд╛рдЗрди - рдЬреИрд╕рд╛ рдХрд┐ рдирд╛рдо рдХрд╛ рдЕрд░реНрде рд╣реИ, рдбрд┐рдЬрд╛рдЗрди рд╡рд┐рд╡рд░рдг рдпрд╣рд╛рдВ рд╕реНрдерд┐рдд рд╣реИрдВ - рдпрд╣ рддрд░реНрдХ рдФрд░ рдмреНрд▓реЙрдХ рдЖрдЙрдЯрдкреБрдЯ рдЯреЗрдореНрдкрд▓реЗрдЯ рд╣реИ; рд╕реАрдзреЗ рд╕реАрдПрд╕рдПрд╕ рд╢реИрд▓рд┐рдпреЛрдВ рдХрд╛ рд╡рд░реНрдгрди, рд▓рд┐рдкрд┐рдпреЛрдВ рдФрд░ рдЪрд┐рддреНрд░реЛрдВ рдХреЛ рдПрдХ рдЕрд▓рдЧ рд╕реНрдерд╛рди рдкрд░ рдирд┐рдХрд╛рд▓рд╛ рдЧрдпрд╛
рдЖрджрд┐ - рд╡рд┐рдиреНрдпрд╛рд╕ рдлрд╛рдЗрд▓
рд╕реНрдерд╛рдиреАрдп - рдореВрд▓ рднрд╛рд╖рд╛ рдлрд╝рд╛рдЗрд▓реЗрдВ, рдпрд╛, рджреВрд╕рд░реЗ рд╢рдмреНрджреЛрдВ рдореЗрдВ, рдЖрдЙрдЯрдкреБрдЯ рдХрд╛ рд╕реНрдерд╛рдиреАрдпрдХрд░рдг; рдПрдХ рд╡рд┐рд╢рд┐рд╖реНрдЯ рдЕрдВрддрд░рдлрд▓рдХ рдХреЗ рд▓рд┐рдП, рд╕реНрдерд╛рдиреАрдп рдЙрдк-рдЙрддреНрдкрд╛рджрди рдХреЛ рдбрд┐рдЬрд╝рд╛рдЗрди рдЙрдкрдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛рдУрдВ рдореЗрдВ рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рдЗрдВрдЯрд░рдлрд╝реЗрд╕ рдХреЗ рд╡рд┐рд╡рд░рдг рдореЗрдВ рдЖрдВрд╢рд┐рдХ рдпрд╛ рдкреВрд░реА рддрд░рд╣ рд╕реЗ рдкреБрдирд░реНрдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд┐рдпрд╛ рдЬрд╛ рд╕рдХрддрд╛ рд╣реИред

рдЗрд╕ рдХрд╛рд░реНрдп рдХреЗ рд▓рд┐рдП, рд╣рдо рдХреЛрдб рдирд┐рд░реНрджреЗрд╢рд┐рдХрд╛ рдореЗрдВ рд░реБрдЪрд┐ рд░рдЦрддреЗ рд╣реИрдВред рдЗрд╕рдореЗрдВ рд╣рдо рддреАрди рдорд╛рдирдХ рдлрд╝реЛрд▓реНрдбрд░ рджреЗрдЦрддреЗ рд╣реИрдВ: рдХреЛрд░ - рдореЗрдВ рд╕рд┐рд╕реНрдЯрдо рдХреЗ рдореБрдЦреНрдп рдореЙрдбреНрдпреВрд▓ рдХреЗ рдХреЛрдб рд╣реЛрддреЗ рд╣реИрдВ, рд╕рд╛рде рд╣реА рд╕рдореБрджрд╛рдп рдФрд░ рд╕реНрдерд╛рдиреАрдп , рдЬреЛ рд╢реБрд░реВ рдореЗрдВ рдЦрд╛рд▓реА рд╣реЛрддреЗ рд╣реИрдВ рдФрд░ рддреАрд╕рд░реЗ рдкрдХреНрд╖ рдХреЗ рдореЙрдбреНрдпреВрд▓ (рд╕рдореБрджрд╛рдп) рдХреЛ рд╕реНрдерд╛рдкрд┐рдд рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдбрд┐рдЬрд╝рд╛рдЗрди рдХрд┐рдП рдЧрдП рд╣реИрдВ рдпрд╛ рд╕реНрд╡рддрдВрддреНрд░ рд░реВрдк рд╕реЗ рд╡рд┐рдХрд╕рд┐рдд рдХрд┐рдП рдЧрдП рд╣реИрдВ (рд╕реНрдерд╛рдиреАрдп)ред рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ, рдлрд╝реЛрд▓реНрдбрд░реНрд╕ рдХреЗ рдмреАрдЪ рдХреЛрдИ рдЕрдВрддрд░ рдирд╣реАрдВ рд╣реИрдВ, рд▓реЗрдХрд┐рди рд╕реБрд╡рд┐рдзрд╛ рдХреЗ рд▓рд┐рдП, рд╣рдо рдЕрдкрдиреЗ рд╕реНрд╡рдпрдВ рдХреЗ рдореЙрдбреНрдпреВрд▓ рдХреЛ рд╕реНрдерд╛рдиреАрдп рдлрд╝реЛрд▓реНрдбрд░ рдореЗрдВ рдЬреЛрдбрд╝ рджреЗрдВрдЧреЗред

рдЗрд╕рд▓рд┐рдП, рд╢реБрд░реБрдЖрдд рдХреЗ рд▓рд┐рдП, рд╣рдореЗрдВ рдПрдХ рдлрд╝реЛрд▓реНрдбрд░ рдмрдирд╛рдиреЗ рдХреА рдЖрд╡рд╢реНрдпрдХрддрд╛ рд╣реИ рдЬрд┐рд╕рдореЗрдВ рд╣рдорд╛рд░реЗ рдореЙрдбреНрдпреВрд▓ рд╢рд╛рдорд┐рд▓ рд╣реЛрдВрдЧреЗред рдЗрд╕ рдлрд╝реЛрд▓реНрдбрд░ рдХрд╛ рдирд╛рдо рдореЙрдбреНрдпреВрд▓ рдХреЗ рдкреИрдХреЗрдЬ рдХрд╛ рдирд╛рдо рд╣реЛрдЧрд╛ рдЬрд┐рд╕реЗ рд╣рдо рд╡рд┐рдХрд╕рд┐рдд рдХрд░реЗрдВрдЧреЗред рдХреНрдпреЛрдВрдХрд┐ рдореИрдВрдиреЗ рдЕрдкрдиреА рдкрд░рд┐рдпреЛрдЬрдирд╛ рдХреЗ рд▓рд┐рдП рдореЙрдбреНрдпреВрд▓ рд╡рд┐рдХрд╕рд┐рдд рдХрд┐рдП, рдореЗрд░реЗ рдкрд╛рд╕ рдореМрдЬреВрдж рдлрд╝реЛрд▓реНрдбрд░ рдореЗрдВ рдкрд░рд┐рдпреЛрдЬрдирд╛ рдХрд╛ рдирд╛рдо рд╣реИ - рд╕рд┐рдлреНрд░рдоред

%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/In144026/


All Articles