Add another "Buy" button

  • Posts: 48
  • Thank you received: 0
10 years 10 months ago #179097

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : Chrome

On this page:
suzy-godsey.com/digit/index.php/user/checkout

We'd like to add another "Buy" button @ the bottom of the list of items to purchase.
...so that you don't have to scroll back up after reviewing the table of products the shopper is getting.
Please advise how we could do this.

Thank you!

Last edit: 10 years 10 months ago by solwebsolutions.

Please Log in or Create an account to join the conversation.

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 10 months ago #179167

Hi,

Would it be possible to have more details ?
I do not see what you want to achieve.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 10 months ago #179252

Hi!
If you start here:
suzy-godsey.com/digit/index.php/shop/product/listing

Add something to the cart...anything.

then, add 3 more things to the cart...and scroll through to view what you have in your cart.

The user has to scroll back up to click the "Buy" button.
We'd like to have a "Buy" button @ the bottom of the page too...not just one @ the top.

Is this possible?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #179271

Hi,

Do you have edited the view "checkout / step" ? Because by default the "Buy" button is at the bottom of the page, not at the top.
So you can backup and reset this view to have the button at the bottom, or edit the view to add the button at the bottom too.

It is maybe your template which has this modification.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182337

Hi!

yes, we've actually moved the button to the top, but would also like it at the bottom to make it easy for someone to checkout.
Please advise how to add the 2nd "Buy" button to the bottom under the cart items.

See attached.

Thank you!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #182348

Hi,

If you moved the button at the top, why not copy the moved code at the bottom too directly ?
The code to add is:

		if($this->nextButton)
		{
			if($this->step == (count($this->steps) - 2)) {
				$checkout_next_button = JText::_('CHECKOUT_BUTTON_FINISH');
				if($checkout_next_button == 'CHECKOUT_BUTTON_FINISH')
					$checkout_next_button = JText::_('NEXT');
			} else
				$checkout_next_button = JText::_('NEXT');
			echo $this->cart->displayButton($checkout_next_button,'next',$this->params, hikashop_completeLink('checkout&task=step&step='.$this->step+1),'if(hikashopCheckChangeForm(\'order\',\'hikashop_checkout_form\')){ if(hikashopCheckMethods()){ document.getElementById(\'hikashop_validate\').value=1; this.disabled = true; document.forms[\'hikashop_checkout_form\'].submit();}} return false;','id="hikashop_checkout_next_button"');
			$button = $this->config->get('button_style','normal');
			 	if ($button=='css')
					echo '<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/></input>';
		}

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182504

Hi!

Thanks for the code block, but I've pasted the PHP code in several different spots, and the button isn't showing @ the bottom.

Please advise.

Thank you!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 846
  • Thank you received: 92
10 years 9 months ago #182506

Hi
Could you see the 2 buttons in the html code ?
regard's

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182531

I've removed the customization via the trash can icon click, deleted cache, and the buy button is still on top.

I know where I want to put the button by just typing in "button here"...that I can see in the correct place.
When I use this code, even inspecting the element via Chrome doesn't see the button:

<div class="clear_both"></div>

<?php
if($this->nextButton)
{
if($this->step == (count($this->steps) - 2)) {
$checkout_next_button = JText::_('CHECKOUT_BUTTON_FINISH');
if($checkout_next_button == 'CHECKOUT_BUTTON_FINISH')
$checkout_next_button = JText::_('NEXT');
} else
$checkout_next_button = JText::_('NEXT');
echo $this->cart->displayButton($checkout_next_button,'next',$this->params, hikashop_completeLink('checkout&task=step&step='.$this->step+1),'if(hikashopCheckChangeForm(\'order\',\'hikashop_checkout_form\')){ if(hikashopCheckMethods()){ document.getElementById(\'hikashop_validate\').value=1; this.disabled = true; document.forms[\'hikashop_checkout_form\'].submit();}} return false;','id="hikashop_checkout_next_button"');
$button = $this->config->get('button_style','normal');
if ($button=='css')
echo '<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/></input>';
}
?>

Please Log in or Create an account to join the conversation.

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 9 months ago #182589

Hi,

Change the lines:
if($this->nextButton)
to:
if(true)
in that view and you should get the next button at the bottom on the checkout page.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182607

tried...no luck...see attached code used

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #182621

Hi,

Please replace the whole code by:

<div id="hikashop_checkout_page" class="hikashop_checkout_page hikashop_checkout_page_step<?php echo $this->step; ?>">
	<?php
	if(hikashop_level(1)){
		$open_hour = $this->config->get('store_open_hour',0);
		$close_hour = $this->config->get('store_close_hour',0);
		$open_minute = $this->config->get('store_open_minute',0);
		$close_minute = $this->config->get('store_close_minute',0);
		if($open_hour!=$close_hour || $open_minute!=$close_minute){
			function getCurrentDate($format = '%H'){
				if(version_compare(JVERSION,'1.6.0','>=')) $format = str_replace(array('%H','%M'),array('H','i'),$format);
				return (int)JHTML::_('date',time()- date('Z'),$format,null);
			}
			$current_hour = hikashop_getDate(time(),'%H');
			$current_minute = hikashop_getDate(time(),'%M');
			$closed=false;
			if($open_hour<$close_hour || ($open_hour==$close_hour && $open_minute<$close_minute)){
				//are we before the open hour ?
				if($current_hour<$open_hour || ($current_hour==$open_hour && $current_minute<$open_minute)){
					//we are before the open hour
					$closed=true;
				}
				//are we after the close hour ?
				if($close_hour<$current_hour || ($current_hour==$close_hour && $close_minute<$current_minute)){
					//we are after the close hour
					$closed=true;

				}
			}else{
				$closed=true;

				//are we before the close hour ?
				if($current_hour<$close_hour || ($current_hour==$close_hour && $current_minute<$close_minute)){
					//we are before the close hour
					$closed=false;
				}
				//are we after the open hour ?
				if($open_hour<$current_hour || ($current_hour==$open_hour && $open_minute<$current_minute)){
					//we are after the open hour
					$closed=false;

				}
			}
			if($closed){
				$app=& JFactory::getApplication();
				$app->enqueueMessage(JText::sprintf('THE_STORE_IS_ONLY_OPEN_FROM_X_TO_X',$open_hour.':'.sprintf('%02d', $open_minute),$close_hour.':'.sprintf('%02d', $close_minute)));
				echo '</div>';
				return;
			}
		}
	}

	global $Itemid;
	$checkout_itemid = $this->config->get('checkout_itemid');
	if(!empty($checkout_itemid )){
		$Itemid = $checkout_itemid ;
	}
	$url_itemid='';
	if(!empty($Itemid)){
		$url_itemid='&Itemid='.$Itemid;
	}

	if($this->display_checkout_bar){
		if(HIKASHOP_RESPONSIVE) {
?>
			<div class="hikashop_wizardbar">
				<ul>
<?php
		} else {
?>
			<div id="hikashop_cart_bar" class="hikashop_cart_bar">
<?php
		}

			$already=true;
			if (count($this->steps) > $this->step+1) $link=true;
			foreach($this->steps as $k => $step){
				$step=explode('_',trim($step));
				$step_name = reset($step);
				if($this->display_checkout_bar==2 && $step_name=='end'){
					continue;
				}
				$class = '';
				$badgeClass = '';
				if($k == $this->step){
					$already = false;
					$class .= ' hikashop_cart_step_current';
					$badgeClass = 'info';
				}
				if($already){
					$class .= ' hikashop_cart_step_finished';
					$badgeClass = 'success';
				}

				if(HIKASHOP_RESPONSIVE) {
?>
				<li class="<?php echo trim($class); ?>">
					<span class="badge badge-<?php echo $badgeClass; ?>"><?php echo ($k + 1); ?></span>
<?php
						if($k == $this->step || empty($link)) {
							echo JText::_('HIKASHOP_CHECKOUT_'.strtoupper($step_name));
						} else {
?>
						<a href="<?php echo hikashop_completeLink('checkout&task=step&step='.$k.$url_itemid);?>">
							<?php echo JText::_('HIKASHOP_CHECKOUT_'.strtoupper($step_name));?>
						</a>
<?php
						}
?>
					<span class="hikashop_chevron"></span>
				</li>

<?php
				} else {
?>
				<div class="hikashop_cart_step<?php echo $class;?>">
					<span><?php
						if($k == $this->step || empty($link)){
							echo JText::_('HIKASHOP_CHECKOUT_'.strtoupper($step_name));
						}else{ ?>
						<a href="<?php echo hikashop_completeLink('checkout&task=step&step='.$k.$url_itemid);?>">
							<?php echo JText::_('HIKASHOP_CHECKOUT_'.strtoupper($step_name));?>
						</a>
					<?php }
					?></span>
				</div><?php
				}
			}
			?>
			</div>
<?php
	}
	if(empty($this->noform)){
		?>
		<form action="<?php echo hikashop_completeLink('checkout&task=step&step='.($this->step+1).$url_itemid); ?>" method="post" name="hikashop_checkout_form" enctype="multipart/form-data" onsubmit="if('function' == typeof(hikashopSubmitForm)) { hikashopSubmitForm('hikashop_checkout_form'); return false; } else { return true; }">
		<?php
	}

		if(true)
		{
			if($this->step == (count($this->steps) - 2)) {
				$checkout_next_button = JText::_('CHECKOUT_BUTTON_FINISH');
				if($checkout_next_button == 'CHECKOUT_BUTTON_FINISH')
					$checkout_next_button = JText::_('NEXT');
			} else
				$checkout_next_button = JText::_('NEXT');
			echo $this->cart->displayButton($checkout_next_button,'next',$this->params, hikashop_completeLink('checkout&task=step&step='.$this->step+1),'if(hikashopCheckChangeForm(\'order\',\'hikashop_checkout_form\')){ if(hikashopCheckMethods()){ document.getElementById(\'hikashop_validate\').value=1; this.disabled = true; document.forms[\'hikashop_checkout_form\'].submit();}} return false;','id="hikashop_checkout_next_button"');
			$button = $this->config->get('button_style','normal');
			 	if ($button=='css')
					echo '<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/></input>';
		}

	$dispatcher = JDispatcher::getInstance();
	$this->nextButton = true;
	foreach($this->layouts as $layout) {
		$layout = trim($layout);
		if($layout == 'end') {
			$this->continueShopping = '';
		}
		if(substr($layout, 0, 4) != 'plg.') {
			$this->setLayout($layout);
			echo $this->loadTemplate();
		} else {
			$html = '';
			$dispatcher->trigger('onCheckoutStepDisplay', array($layout, &$html, &$this));
			if(!empty($html)) {
				echo $html;
			}
		}
	}
	if(empty($this->noform)){
		?>
		<input type="hidden" name="Itemid" value="<?php echo $Itemid; ?>"/>
		<input type="hidden" name="option" value="com_hikashop"/>
		<input type="hidden" name="ctrl" value="checkout"/>
		<input type="hidden" name="task" value="step"/>
		<input type="hidden" name="previous" value="<?php echo $this->step; ?>"/>
		<input type="hidden" name="step" value="<?php echo $this->step+1; ?>"/>
		<input type="hidden" id="hikashop_validate" name="validate" value="0"/>
		<?php echo JHTML::_( 'form.token' ); ?>
		<input type="hidden" name="unique_id" value="[<?php echo md5(uniqid())?>]"/>
		<br style="clear:both"/>
		<?php

		if(true)
		{
			if($this->step == (count($this->steps) - 2)) {
				$checkout_next_button = JText::_('CHECKOUT_BUTTON_FINISH');
				if($checkout_next_button == 'CHECKOUT_BUTTON_FINISH')
					$checkout_next_button = JText::_('NEXT');
			} else
				$checkout_next_button = JText::_('NEXT');
			echo $this->cart->displayButton($checkout_next_button,'next',$this->params, hikashop_completeLink('checkout&task=step&step='.$this->step+1),'if(hikashopCheckChangeForm(\'order\',\'hikashop_checkout_form\')){ if(hikashopCheckMethods()){ document.getElementById(\'hikashop_validate\').value=1; this.disabled = true; document.forms[\'hikashop_checkout_form\'].submit();}} return false;','id="hikashop_checkout_next_button"');
			$button = $this->config->get('button_style','normal');
			 	if ($button=='css')
					echo '<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/></input>';
		}
		?>
		</form>
		<?php
		if($this->continueShopping){
			if(strpos($this->continueShopping,'Itemid')===false){
				if(strpos($this->continueShopping,'index.php?')!==false){
					$this->continueShopping.=$url_itemid;
				}
			}
			if(!preg_match('#^https?://#',$this->continueShopping)) $this->continueShopping = JURI::base().ltrim($this->continueShopping,'/');
			echo $this->cart->displayButton(JText::_('CONTINUE_SHOPPING'),'continue_shopping',$this->params,JRoute::_($this->continueShopping),'window.location=\''.JRoute::_($this->continueShopping).'\';return false;','id="hikashop_checkout_shopping_button"');
		}
	}
	?>
</div>
<div class="clear_both"></div>
<?php

if(JRequest::getWord('tmpl','')=='component'){
	exit;
}
If this doesn't work as expected, so you are not editing the view in the correct template, or you have another override in the folder "templates/YOUR_TEMPLATE/html/com_hikashop".
Or it is a cache issue, maybe server cache or another one.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182709

Hello!

The code did not work:
suzy-godsey.com/digit/index.php/shop

Where would I see this next / bottom "Buy" button?
Should it be under the PayPal area?

Please advise...I've cleared cache and tried different browsers.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #182723

Hi,

I can see the two buttons on your checkout page, one at the top, and the other one at the bottom.
So it seems that everything is ok.

Please Log in or Create an account to join the conversation.

  • Posts: 48
  • Thank you received: 0
10 years 9 months ago #182835

Thank you so much for the support!

Please Log in or Create an account to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum