Skip Navigation

[Resolved] Custom Product Template – Product Image Gallery Slider excluding Featured Image

This thread is resolved. Here is a description of the problem and solution.

Problem:
Custom Product Template – Product Image Gallery Slider excluding Featured Image

Solution:

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/custom-product-template-product-image-gallery-slider-excluding-featured-image/page/2/#post-1271753

Relevant Documentation:

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 23 replies, has 3 voices.

Last updated by paulA-9 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1271015

The id is not working. It shows as text on the page for some reason.

How is this happening?

#1271111
Screen Shot 2019-06-17 at 2.28.34 PM.png

I have isolated the sample button. Please see screenshot.

#1271145

I need faster support. I am not getting fast enough responses here.

#1271257

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sorry if you feel so but looks like we are in a different timezone.

However, I've checked now and I also checked the rendered HTML output of button and I can see now value attribute for the button is rendered correctly. I've adjusted the code as given under:


function display_display_sample_btn() {
 global $post;
  
 $str .='<form class="cart" method="post" enctype="multipart/form-data">';
 $str .= '<button type="submit" name="add-to-cart" value="'.$post->ID.'" class="single_add_to_cart_button button alt">Order a Free Sample</button>';
 $str .= '<input type="hidden" name="free_sample" value="'.$post->ID.'">';
 $str .= '</form>';
 
  return $str;
 
    }
add_shortcode( 'woo_display_sample_btn', 'display_display_sample_btn' );
#1271419

Thanks but now this is not working. It functions like a regular add to cart button instead.

What I expected:
When click on "Order a Free Sample", it will add "Free Sample (Product Name)".

Instead:
Adds normal product to cart.

Thank you,

#1271437

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I can help you to run the code but I do not know about the free sample and how it works. Do you want me to place to code to the functions.php file as before?

#1271731

hidden link

Here is the source for the free sample code. I believe since we changed theID() , it no longer is passing the information to the cart.

#1271753

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I think the mistake was we need to replace the sample product ID - in your case the sample product ID is 2689.

I've added the sample product ID accordingly - Can you please check:

function display_display_sample_btn() {
 global $post;
  
 $str .='<form class="cart" method="post" enctype="multipart/form-data">';
 $str .= '<button type="submit" name="add-to-cart" value="2689" class="single_add_to_cart_button button alt">Order a Free Sample</button>';
 $str .= '<input type="hidden" name="free_sample" value="'.$post->ID.'">';
 $str .= '</form>';
 
  return $str;
 
    }
add_shortcode( 'woo_display_sample_btn', 'display_display_sample_btn' );
#1276947

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.