Layout custom fields in checkout page

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197393

-- url of the page with the problem -- : www.ijsbaanleuven.be
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1

HI !

I would like to change the layout of the custom fields in the checkout page.

Now you have the name of the field, and then in the next line, you get the value the customer entered. The next field is again on a new line etc ...

I would like to have the name of the field and the value the customer entered on the same line.

How to go about this ?
I tried to make some changes in the Display > Views > Checkout / customfields page, but this does not seem to have any effect.

So, I would like the value "123" behind Skater, and the next value "123" behind Coach.

Also, I would like to remove the Quantity box, so that the customer can not order the same product with the same values in the custom fields twice.

Thanks for your never ending support ...

Joris

Attachments:
Last edit: 9 years 7 months ago by ijsbaanleuven.

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197423

Removal of the quantitiy box = found :
Display > Views > Checkout / Cart.php

Thanks !

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 7 months ago #197444

Hi,

That's the right view.
You can also use some custom CSS if you just want to change some colors or alignments.

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.
The following user(s) said Thank You: ijsbaanleuven

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197477

hi Jerome,

Thanks for answering.
I cannot find the code regarding the custom fields...

Can you help me ?

BR,
Joris

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197483

Hi there !


Meanwhile I found in the previous mentioned file this code :

$html = ob_get_clean();
								if(!empty($html)){
									echo '<div class="hikashop_cart_product_custom_item_fields">'.$html.'</div>';
								}

If I comment this out, the custom fields are not shown.
But I do want them to show, but just in 1 line per field, and with <br /> not <p>.
In witch file is the class hikashop_cart_product_custom_item_fields defined ?

BR,
Joris

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 7 months ago #197478

Hi,

foreach($this->extraFields['item'] as $field){
	$namekey = $field->field_namekey;
	if(empty($row->$namekey) || !strlen($row->$namekey)) continue;
	echo '<p class="hikashop_cart_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'</p>';
}

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: 72
  • Thank you received: 2
9 years 7 months ago #197557

Hi Jerome,


Thanks for the help. I thought indeed that that was the part where I needed to look.
I just seem not able to get the fields in 1 row ...

Can you give any further assistance ?

Thnks!
Joris

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

  • Posts: 13201
  • Thank you received: 2322
9 years 7 months ago #197558

Hi,

To have the fields in one row, you can use that code:

echo '<p  class="hikashop_cart_item_field">';
foreach($this->extraFields['item'] as $field){
	$namekey = $field->field_namekey;
	if(empty($row->$namekey) || !strlen($row->$namekey)) continue;
	echo $this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey);
}
echo '</p>';

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197683

Xavier,

Thanks for the help, but I obviously not good in php ...:-(

I now use this code :

<?php
								ob_start();
								if(hikashop_level(2) && !empty($this->extraFields['item'])){
									echo '<p class="hikashop_cart_item_field">';
foreach($this->extraFields['item'] as $field){
 $namekey = $field->field_namekey;
 if(empty($row->$namekey) || !strlen($row->$namekey)) continue;
 echo $this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey);
}
echo '</p>';
									
								}

But is has no effect on my checkout page ...

What am I doing wrong ?

Thnks for all the help ...
Feeling like a noob ... :-)

Funny thing is, that in the emails i get from the orders, everything is like i want it ...

Attachments:
Last edit: 9 years 7 months ago by ijsbaanleuven.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 7 months ago #197747

Hi,

Sorry my code is to display the fields in one line, and not one column, I misunderstood your request.
Please use that code instead:

foreach($this->extraFields['item'] as $field){
	$namekey = $field->field_namekey;
	if(empty($row->$namekey) || !strlen($row->$namekey)) continue;
	echo $this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'<br/>';
}

And as would have said Mohamed Thelji:

Are you sure that you are editing the good file of the of the front-end template via "Hikashop->Display->Views" ?

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197832

Xavier,


yes I have the correct file, since I've already deleted the quantity box on the checkout page.

My code on this page from the TD for showing the product name : In red the code I got from Xavier, but this has no effect on my page ...
Refreshed cache from the browser, tried different browsers, ...

<td data-title="<?php echo JText::_('CART_PRODUCT_NAME'); ?>" class="hikashop_cart_product_name_value">
								<p class="hikashop_cart_product_name">
									<?php
										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;
										} ?>
									<?php if(@$defaultParams['link_to_product_page']){ ?><a class="hikashop_no_print" href="<?php echo hikashop_contentLink('product&task=show&cid='.$row->product_id.'&name='.$row->alias.$url_itemid,$row);?>" ><?php } ?>
										<?php echo $row->product_name; ?>
										<?php if ($this->config->get('show_code')) { ?>
											<span class="hikashop_product_code_checkout"><?php echo $row->product_code; ?></span>
										<?php } ?>
									<?php if(@$defaultParams['link_to_product_page']){ ?></a><?php } ?>
									<?php
									if($group){
										$display_item_price=false;
										foreach($this->rows as $j => $optionElement){
											if($optionElement->cart_product_option_parent_id != $row->cart_product_id) continue;
											if(!empty($optionElement->prices[0])){
												$display_item_price = true;
											}

										}
										if($display_item_price){
											$this->row=&$row;
											$this->unit=true;
											echo  ' <span class="hikashop_product_base_price">'.strip_tags($this->loadTemplate()).'</span>';
										}
									}
									?>
								</p>
								<?php
								ob_start();
								if(hikashop_level(2) && !empty($this->extraFields['item'])){
									[color=#ff0000]foreach($this->extraFields['item'] as $field){
                                                                         $namekey = $field->field_namekey;
                                                                         if(empty($row->$namekey) || !strlen($row->$namekey)) continue;
                                                                         echo $this->fieldsClass->getFieldName($field).' : '.$this->fieldsClass->show($field,$row->$namekey).'<br/>';[/color]
                                                                  }
									
								}
								$input='';
								if($group){
									foreach($this->rows as $j => $optionElement){
										if($optionElement->cart_product_option_parent_id != $row->cart_product_id) continue;
										if(!empty($optionElement->prices[0])){
											if(!isset($row->prices[0])){
												$row->prices[0] = new stdClass();
												$row->prices[0]->price_value=0;
												$row->prices[0]->price_value_with_tax=0;
												$row->prices[0]->price_currency_id = hikashop_getCurrency();
											}
											foreach(get_object_vars($row->prices[0]) as $key => $value){
												if(is_object($value)){
													foreach(get_object_vars($value) as $key2 => $var2){
														if(strpos($key2,'price_value')!==false) $row->prices[0]->$key->$key2 +=@$optionElement->prices[0]->$key->$key2;
													}
												}else{
													if(strpos($key,'price_value')!==false) $row->prices[0]->$key+=@$optionElement->prices[0]->$key;
												}
											}
										}
										echo '<p class="hikashop_cart_option_name">'.$optionElement->product_name;
										if(@$optionElement->prices[0]->price_value_with_tax>0){
											echo ' ( + ';
											$this->row=&$optionElement;
											$this->unit=true;
											echo strip_tags($this->loadTemplate()).' )';
										}
										echo '</p>';
										$input .='document.getElementById(\'product_option_'.$optionElement->cart_product_id.'\').value=qty_field.value;';
										if(empty($this->disable_modifications)) echo '<input type="hidden" id="product_option_'.$optionElement->cart_product_id.'" name="item['.$optionElement->cart_product_id.']" value="'.$row->cart_product_quantity.'"/>';
									}
								}
								$html = ob_get_clean();
								if(!empty($html)){
									echo '<div class="hikashop_cart_product_custom_item_fields">'.$html.'</div>';
								}
								?>
							</td>

Thanks for all the help, I own you guys a beer and a free ice skating session if you ever visit Leuven, Belgium !

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 7 months ago #197842

Hi,

I don't think that you need to change any PHP/HTML code for that.
Just some simple CSS should allow you to have the label/value of the fields on the same line.
I tried to look at your website to check on your CSS but I couldn't find your shop.
Please provide a direct link to it so that we can access it.

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #197967

Nicolas,

This part of the shop is not yet available for the public.
I will send you a PM with credentials.

Thanks for your help ...

BR,
Joris

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 7 months ago #198104

Hi,

Please use the "contact us" form instead of private message.
(and please provide a link to the forum thread when using the "contact us" form, so we will understand what to do with the credentials)

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.
The following user(s) said Thank You: ijsbaanleuven

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #198111

Email has been sent,

Thanks a lot guys !

J.

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 7 months ago #198128

Hi,

Just add this CSS on your website and it will do the job:
.hikashop_cart_product_custom_item_fields label{ display: inline !important; }

www.hikashop.com/support/support/documen...ize-the-display.html

The following user(s) said Thank You: ijsbaanleuven, tbroderick

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

  • Posts: 72
  • Thank you received: 2
9 years 7 months ago #198158

Thanks Nicolas, This did the trick !

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

  • Posts: 112
  • Thank you received: 3
9 years 6 months ago #201030

Likely a very simple answer: I want to resize the quantity box in the cart on the checkout page. Where is the CSS for this located? or how do I change the size?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #201068

Hi,

This css is located in the frontend css file via the menu Configuration > Display > CSS.
If not present, you can add your own css properties at the end of the file.

Here is a tutorial on how to customise the display:
www.hikashop.com/support/support/documen...ize-the-display.html

The following user(s) said Thank You: tbroderick

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

Time to create page: 0.111 seconds
Powered by Kunena Forum