Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Troubleshooting › Problem with the optional Button Link
Tagged: buttion link, fancy2 display, optional button link
- This topic has 4 replies, 2 voices, and was last updated 13 years, 8 months ago by amin007.
-
AuthorPosts
-
April 6, 2011 at 8:11 am #3127RinaldoMember
I have a problem with the optional Button Link: “Only use this if you want the Add to Cart button for this product to go to the specified URL (eg. a landing page) instead of adding the product to the shopping cart. Useful when you are selling/promoting product of others.”
It does not open the page link I have inserted (inserted the same link in the thumb and it works) but immediately adds the product to the cart. It works though on my localhost, but I cant see a difference in the settings. I am running out of ideas …
Thanks!
April 6, 2011 at 8:44 am #31118RinaldoMemberI found the reason, but not the solution. In fancy style 3 it works, but not in style 2. I presume that is my change in misc_functions.php, where I moved the get url button further down. I dont really understand what I was doing there, so here is my code change:
function get_button_code_fancy2_for_element($ret_product,$line_break=true)
{
if($ret_product)
{
if (is_numeric ($ret_product->available_copies))
{
if ($ret_product->available_copies < 1)// No more copies left
{
$replacement = ‘<input type=”image” src=”‘.WP_ESTORE_SOLD_OUT_IMAGE.'” class=”eStore_sold_out” title=”This item has been sold out” alt=”SOLD OUT”/>’;
return $replacement;
}
}
$replacement .= ‘<object class=”eStore_button_object”>’;
$replacement .= ‘<form method=”post” action=”” style=”display:inline” onsubmit=”return ReadForm1(this, 1);”>’;
/* $replacement .= get_input_button($ret_product->button_image_url);
$replacement .= ” “; änderung RS */
//If custom price option is set
if($ret_product->custom_price_option==’1′)
{
$replacement .= WP_ESTORE_YOUR_PRICE.’: <input type=”text” name=”custom_price” size=”3″ value=”” /> ‘;
if ($line_break) $replacement .= ‘
‘;}
if($ret_product->show_qty==’1′)
{
$replacement .= ESTORE_QUANTITY.’: <input type=”text” name=”add_qty” size=”1″ value=”1″ />’;
if ($line_break) $replacement .= ‘
‘;}
else
{
$replacement .= ‘<input type=”hidden” name=”add_qty” value=”1″ />’;
}
$var_output = get_variation_and_input_code($ret_product,$line_break);
if (!empty($var_output))
{
$replacement .= ” “;
$replacement .= $var_output;
}
$replacement .= get_input_button($ret_product->button_image_url);
$replacement .= ” “; /* RS */
Thank you very much for any hints.
April 7, 2011 at 1:40 am #31119amin007ParticipantYou shouldn’t need to do any code modification to get this working:
What version of eStore are you using? Can you post a link to a page where you are using this feature and the link is not sending you to the target URL? You have specified the target URL In the “Button Link” field of that product right?
April 7, 2011 at 8:07 am #31120RinaldoMemberMisunderstanding, you told me : “You will need to modify the “get_button_code_fancy2_for_element” function to change fancy2 display.
The following code in that function is responsible for the showing the button.
get_input_button($ret_product->button_image_url);
If you want to place the button after the variation then place that line after the variation code. “
I did, as shown above and it worked, but I assume the problem with the url forwarding is related to my code modification, since style3 is working. I set up a sample page with both styles here: http://gotarda.com/a_segovia/
April 8, 2011 at 12:54 am #31121amin007ParticipantFirst of all, I have no way of knowing what code modification you did for what purpose unless you tell me in this thread
I do not memorize discussions that we may have add on a different thread (Sometimes I don’t even look at the username when replying).
All I can tell you is that the redirect function works fine on fancy2 or any other display as is. If you have done code modification for other purpose then you need to look at the modification again and see what the issue is. I can’t really troubleshoot custom code modifications.
The following code block is important for the redirection option and cannot be moved:
if (!empty($ret_product->target_button_url))
{
$replacement = '<form method="post" action="'.$ret_product->target_button_url.'" style="display:inline">';
$replacement .= get_input_button($ret_product->button_image_url);
$replacement .= " ";
$replacement .= '</form>';
return $replacement;
}There are two instances of the following function call… the one in the above mentioned code block cannot move:
get_input_button($ret_product->button_image_url);
-
AuthorPosts
- You must be logged in to reply to this topic.