Jump to content

[solved] move currency block above buy block on product page


Recommended Posts

I can give you a quick solution but probably not so 'smart'.

you can add an absolute position to currency block just for product page assuming you have a space to put it like you show in the image.

 

you can do it in product.tpl with inline style: {if $page_name == 'product'} or by css: body#product #currencies_block_top {position: absolute; top: xxxx; right: xxxx;} ofcourse you need to find top & right.

 

I guess the 2nd option is easier.

  • Like 1
Link to comment
Share on other sites

The solution you have in the link is not exactly for your needs.

In this solution you will have the currencies block under the add to cart button and not between the price & the items left in stock.

 

There is a hook under the right column of the product info (name, description, attributes, price, add to cart button) that called 'Extra actions on product page' and you can modify the code of the currencies block to be able to transplant in that hook (like Rocky explain in the link you sent).

 

So let me know which way you choose and I will help you.

Link to comment
Share on other sites

I assume that you use prestashop 1.5.3.1?

 

You need to edit 'modules/blockcurrencies/blockcurrencies.php' and instead of all the content put this:

 

  Quote
<?php

/*

* 2007-2012 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.or...ses/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 license@prestashop.com 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 <contact@prestashop.com>

* @copyright 2007-2012 PrestaShop SA

* @license http://opensource.or...ses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*/

 

if (!defined('_PS_VERSION_'))

exit;

 

class BlockCurrencies extends Module

{

public function __construct()

{

$this->name = 'blockcurrencies';

$this->tab = 'front_office_features';

$this->version = 0.1;

$this->author = 'PrestaShop';

$this->need_instance = 0;

 

parent::__construct();

 

$this->displayName = $this->l('Currency block');

$this->description = $this->l('Adds a block for selecting a currency.');

}

 

public function install()

{

return parent::install() && $this->registerHook('top') && $this->registerHook('header');

}

 

private function _prepareHook($params)

{

if (Configuration::get('PS_CATALOG_MODE'))

return false;

 

if (!count(Currency::getCurrencies()))

return false;

 

$this->smarty->assign('blockcurrencies_sign', $this->context->currency->sign);

 

return true;

}

 

/**

* Returns module content for header

*

* @param array $params Parameters

* @return string Content

*/

public function hookTop($params)

{

if ($this->_prepareHook($params))

return $this->display(__FILE__, 'blockcurrencies.tpl');

}

 

function hookExtraRight($params)

{

return $this->hookTop($params);

}

 

public function hookHeader($params)

{

if (Configuration::get('PS_CATALOG_MODE'))

return;

$this->context->controller->addCSS(($this->_path).'blockcurrencies.css', 'all');

}

}

 

 

 

or just download and extract from zip: zip_file

 

after you saved the file go to modules -> positions -> transplant a module, choose currencies block and hook into "Extra actions on the product page (right column)." known as "displayRightColumnProduct" and press save.

 

after you finish those steps take a screen shot of your product page so I can see how it looks and how you need it.

Edited by yaniv14 (see edit history)
  • Like 1
Link to comment
Share on other sites

try replacing all the content of blockcurrencies.css with this:

 

  Quote

 

/* block top currencies */

#currencies_block_top {

float: right;

height: 15px;

margin: 10px 0 0 0;

padding: 2px 6px;

-moz-border-radius-bottomright: 3px;

-moz-border-radius-bottomleft: 3px;

-webkit-border-radius-bottomright: 3px;

-webkit-border-radius-bottomleft: 3px;

border-bottom-right-radius: 3px;

border-bottom-left-radius: 3px;

background: none repeat scroll 0 0 #000;

}

#currencies_block_top p {

clear: left;

padding-right:16px;

font: 11px Arial,Verdana,sans-serif;

color: #ccc;

text-align: right;

background: url("img/block_languages_top_p_bg.png") no-repeat scroll right 1px transparent;

}

#currencies_block_top ul#first-currencies li {

margin-right: 3px

}

#currencies_block_top ul#first-currencies li.selected {

opacity: 1 !important;

}

/*languages with jquery*/

#setCurrency {

cursor: pointer;

position: relative;

top: 1px;

}

#setCurrency p {

position: relative;

top: 0;

margin-left: 5px;

padding-bottom: 0;

}

#setCurrency p img {

padding-left: 5px;

}

#setCurrency .currencies_ul{

display:none;

z-index: 10000;

padding:10px;

list-style-type:none;

}

#setCurrency .currencies_ul_hover{

display:block;

z-index: 5000;

position:absolute;

right:3px;

padding:5px 10px;

height:auto;

width:10px;

background:#000000;

}

#setCurrency .currencies_ul_hover a {color:#fff;}

Link to comment
Share on other sites

×
×
  • Create New...