efsab1213 Posted November 15, 2013 Share Posted November 15, 2013 Herkese merhaba, kampanyalar kutusunda görüntülenen ürünlerin sayısını 1 den 3 e çıkarmak istiyorum modülün kodlarına baktım fakat değiştirmem gereken yeri bulamadım yardımcı olursanız sevinirim. iyi çalışmalar. Link to comment Share on other sites More sharing options...
Presta-TR Posted November 16, 2013 Share Posted November 16, 2013 modülün TPL ve PHP dosyasını burdan paylaşabilirseniz inceliyeyim. Link to comment Share on other sites More sharing options...
efsab1213 Posted November 16, 2013 Author Share Posted November 16, 2013 modülün TPL ve PHP dosyasını burdan paylaşabilirseniz inceliyeyim. buyrun blockspecials modülünün tpl ve php dosyası blockspecials.php <?php /* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) exit; class BlockSpecials extends Module { private $_html = ''; private $_postErrors = array(); function __construct() { $this->name = 'blockspecials'; $this->tab = 'pricing_promotion'; $this->version = '0.9'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Specials block'); $this->description = $this->l('Adds a block displaying current product specials.'); } public function install() { if (!Configuration::get('BLOCKSPECIALS_NB_CACHES')) Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', 20); $this->_clearCache('blockspecials.tpl'); return (parent::install() && $this->registerHook('rightColumn') && $this->registerHook('header') && $this->registerHook('addproduct') && $this->registerHook('updateproduct') && $this->registerHook('deleteproduct') ); } public function uninstall() { $this->_clearCache('blockspecials.tpl'); return parent::uninstall(); } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitSpecials')) { Configuration::updateValue('PS_BLOCK_SPECIALS_DISPLAY', (int)Tools::getValue('always_display')); Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', (int)Tools::getValue('BLOCKSPECIALS_NB_CACHES')); $output .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } return $output.$this->displayForm(); } public function displayForm() { return ' <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> <fieldset> <legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Always display this block.').'</label> <div class="margin-form"> <input type="radio" name="always_display" id="display_on" value="1" '.(Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '').'/> <label class="t" for="display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label> <input type="radio" name="always_display" id="display_off" value="0" '.(!Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '').'/> <label class="t" for="display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label> <p class="clear">'.$this->l('Show the block even if no product is available.').'</p> </div> <label>'.$this->l('Number of cache files.').'</label> <div class="margin-form"> <input type="text" name="BLOCKSPECIALS_NB_CACHES" value="'.(int)Configuration::get('BLOCKSPECIALS_NB_CACHES').'" /> <p class="clear">'.$this->l('Specials are displayed randomly on the front end, but since it takes a lot of ressources, it is better to cache the results. Cache is reset everyday. 0 will disable the cache.').'</p> </div> <center><input type="submit" name="submitSpecials" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; } public function hookRightColumn($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } return $this->display(__FILE__, 'blockspecials.tpl', $this->getCacheId('blockspecials|'.$random)); } public function hookLeftColumn($params) { return $this->hookRightColumn($params); } public function hookHeader($params) { if (Configuration::get('PS_CATALOG_MODE')) return ; $this->context->controller->addCSS(($this->_path).'blockspecials.css', 'all'); } public function hookAddProduct($params) { $this->_clearCache('blockspecials.tpl'); } public function hookUpdateProduct($params) { $this->_clearCache('blockspecials.tpl'); } public function hookDeleteProduct($params) { $this->_clearCache('blockspecials.tpl'); } } blockspecials.tpl {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- MODULE Block specials --> <div id="special_block_right" class="block products_block exclusive blockspecials"> <h4 class="title_block"><a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='Specials' mod='blockspecials'}">{l s='Specials' mod='blockspecials'}</a></h4> <div class="block_content"> {if $special} <ul class="products clearfix"> <li class="product_image"> <a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium_default')|escape:'html'}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> </li> <li> {if !$PS_CATALOG_MODE} {if $special.specific_prices} {assign var='specific_prices' value=$special.specific_prices} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} <span class="reduction"><span>-{$specific_prices.reduction*100|floatval}%</span></span> {/if} {/if} {/if} <h5 class="s_title_block"><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'}</a></h5> {if !$PS_CATALOG_MODE} <span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$special.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if}</span> <span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span> {/if} </li> </ul> <p> <a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='All specials' mod='blockspecials'}">» {l s='All specials' mod='blockspecials'}</a> </p> {else} <p>{l s='No product specials are available at this time.' mod='blockspecials'}</p> {/if} </div> </div> <!-- /MODULE Block specials --> Link to comment Share on other sites More sharing options...
Presta-TR Posted November 16, 2013 Share Posted November 16, 2013 buyrun blockspecials modülünün tpl ve php dosyası blockspecials.php <?php /* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) exit; class BlockSpecials extends Module { private $_html = ''; private $_postErrors = array(); function __construct() { $this->name = 'blockspecials'; $this->tab = 'pricing_promotion'; $this->version = '0.9'; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Specials block'); $this->description = $this->l('Adds a block displaying current product specials.'); } public function install() { if (!Configuration::get('BLOCKSPECIALS_NB_CACHES')) Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', 20); $this->_clearCache('blockspecials.tpl'); return (parent::install() && $this->registerHook('rightColumn') && $this->registerHook('header') && $this->registerHook('addproduct') && $this->registerHook('updateproduct') && $this->registerHook('deleteproduct') ); } public function uninstall() { $this->_clearCache('blockspecials.tpl'); return parent::uninstall(); } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitSpecials')) { Configuration::updateValue('PS_BLOCK_SPECIALS_DISPLAY', (int)Tools::getValue('always_display')); Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', (int)Tools::getValue('BLOCKSPECIALS_NB_CACHES')); $output .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } return $output.$this->displayForm(); } public function displayForm() { return ' <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> <fieldset> <legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Always display this block.').'</label> <div class="margin-form"> <input type="radio" name="always_display" id="display_on" value="1" '.(Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '').'/> <label class="t" for="display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label> <input type="radio" name="always_display" id="display_off" value="0" '.(!Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '').'/> <label class="t" for="display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label> <p class="clear">'.$this->l('Show the block even if no product is available.').'</p> </div> <label>'.$this->l('Number of cache files.').'</label> <div class="margin-form"> <input type="text" name="BLOCKSPECIALS_NB_CACHES" value="'.(int)Configuration::get('BLOCKSPECIALS_NB_CACHES').'" /> <p class="clear">'.$this->l('Specials are displayed randomly on the front end, but since it takes a lot of ressources, it is better to cache the results. Cache is reset everyday. 0 will disable the cache.').'</p> </div> <center><input type="submit" name="submitSpecials" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; } public function hookRightColumn($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } return $this->display(__FILE__, 'blockspecials.tpl', $this->getCacheId('blockspecials|'.$random)); } public function hookLeftColumn($params) { return $this->hookRightColumn($params); } public function hookHeader($params) { if (Configuration::get('PS_CATALOG_MODE')) return ; $this->context->controller->addCSS(($this->_path).'blockspecials.css', 'all'); } public function hookAddProduct($params) { $this->_clearCache('blockspecials.tpl'); } public function hookUpdateProduct($params) { $this->_clearCache('blockspecials.tpl'); } public function hookDeleteProduct($params) { $this->_clearCache('blockspecials.tpl'); } } blockspecials.tpl {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- MODULE Block specials --> <div id="special_block_right" class="block products_block exclusive blockspecials"> <h4 class="title_block"><a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='Specials' mod='blockspecials'}">{l s='Specials' mod='blockspecials'}</a></h4> <div class="block_content"> {if $special} <ul class="products clearfix"> <li class="product_image"> <a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium_default')|escape:'html'}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> </li> <li> {if !$PS_CATALOG_MODE} {if $special.specific_prices} {assign var='specific_prices' value=$special.specific_prices} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} <span class="reduction"><span>-{$specific_prices.reduction*100|floatval}%</span></span> {/if} {/if} {/if} <h5 class="s_title_block"><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'}</a></h5> {if !$PS_CATALOG_MODE} <span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$special.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if}</span> <span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span> {/if} </li> </ul> <p> <a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='All specials' mod='blockspecials'}">» {l s='All specials' mod='blockspecials'}</a> </p> {else} <p>{l s='No product specials are available at this time.' mod='blockspecials'}</p> {/if} </div> </div> <!-- /MODULE Block specials --> Gördüğüm kadarıyla her defasında rast gele 1 ürün buluyor. if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); bu kod bloğunu alın ve şununla değiştirin. if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; if (!($special_2 = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; if (!($special_3 = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'special_2' => $special_2, 'special_3' => $special_3, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); TPL Dosyasındada bulun <li class="product_image"> <a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium_default')|escape:'html'}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> </li> Değiştirin <li class="product_image"> <a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium_default')|escape:'html'}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> </li> <li class="product_image"> <a href="{$special_2.link}"><img src="{$link->getImageLink($special_2.link_rewrite, $special_2.id_image, 'medium_default')|escape:'html'}" alt="{$special_2.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special_2.name|escape:html:'UTF-8'}" /></a> </li> <li class="product_image"> <a href="{$special_3.link}"><img src="{$link->getImageLink($special_3.link_rewrite, $special_3.id_image, 'medium_default')|escape:'html'}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special_3.name|escape:html:'UTF-8'}" /></a> </li> Öncesinde mevcut dosyaların yedeğini almayı unutmayın Link to comment Share on other sites More sharing options...
efsab1213 Posted November 17, 2013 Author Share Posted November 17, 2013 değişikliği yaptım fakat ilginç bir şekilde sitede hiçbir değişiklik olmadı :/ Link to comment Share on other sites More sharing options...
rflx Posted November 17, 2013 Share Posted November 17, 2013 BO'den Advanced Parameters/performance/clear smarty cache & Autoload cache Link to comment Share on other sites More sharing options...
Presta-TR Posted November 20, 2013 Share Posted November 20, 2013 Cache i kapatıp deneyin TPL dosyasının güncel halini sistem okumadı muhtemelenç. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now