call custom field in php by id

  • Posts: 129
  • Thank you received: 0
9 years 4 months ago #238795

-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.1
-- PHP version -- : last
-- Browser(s) name and version -- : last

hi,

i have a custom field in product table with type of text and nam of VIDEO
i want to show a video of my product in a new tab next to "additional info tab" if the custom field has a video link.
and if not i want the tab to be disappear.

i have added the tab and content and i can see the tab and my custom content all i wanna know is :

1. how can i see the content and the value of my customfield id="34" in the content area of my video tab
2. how can i add a condition that if the custom field with id 34 has any value then this tab and content should appear ?


thanks!

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #238871

Hi,

As it is a custom product field, the content is stored in the product PHP object.
The easiest way will be to use the check on the custom field column name.

So in the view, "product / show_tabular", in the video tab you can add code like:

<?php
echo $this->element->product_video; // if you named the video custom field "product_video"
?>

And to display that video tab or not, just add a php if condition around the "<li>" html like:
<?php
if(!empty($this->element->product_video)){
?>
<li>...</li>
<?php
}
?>

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

  • Posts: 129
  • Thank you received: 0
9 years 4 months ago #238926

You are awesoooomeeee !
thanks !

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

  • Posts: 129
  • Thank you received: 0
9 years 4 months ago #239702

hi, i need to change the class of my mini cart in topnav if its empty,
how can i check if my cart is empty or not ?

i want to add a class to the inside div of cart php line 291 :

<a class="hikashop_small_cart_checkout_link" href="javascript:void(0);">
			<div class="hikashop_small_cart_total_title"></div>
		</a>

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

  • Posts: 129
  • Thank you received: 0
9 years 4 months ago #239739

i also need

1. a php code that can return the number of items in the cart

2. i want the cart ul and container opens when shopping card is empty with a notice that the shopping cart is empty
right now when the cart is empty the shopping cart panel-2 module is not opening any window cause it's empty

i'll appreciate your help if you help me on these cases!

thanks

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

  • Posts: 84311
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #239816

Hi,

The if condition to know if the cart is empty or not is this one:
if(empty($this->rows)) {
// empty cart
}else{
// not empty
}

Here is a thread about getting the number of items in the cart from anywhere :
hikashop.com/forum/content-creation/8843...m-module.html#239492

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

Time to create page: 0.074 seconds
Powered by Kunena Forum