Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password?

Search the Forum

Tips and Tricks HQ Forum » WP eStore Forum » WP eStore F.A.Q/Instructions

Why Configure Every Product Separately When Used with NextGen Gallery

(99 posts) (14 voices)
  • Started 1 year ago by amin007
  • Latest reply from admin
  • Related Topics:
    1. Users not being sent login details
    2. Buy now button NOT work
    3. Customer being sent to PayPal despite having PP option turned off
    4. Subscription PayPal Error
    5. How to make the plugin mark the order as a service on paypal

Tags:

  • NextGen Gallery Integration
  • PayPal
  • wp-eStore-auto-addtocart
« Previous1…345…10Next »
  1. darkmatter
    Member

    OK, I've been looking a this tediously and from what I can tell:

    'if(!empty($nggImage->alttext))
    {
    $output .= "<input type=\"hidden\" name=\"item_name\" value=\"$nggImage->alttext\" />";
    }
    else
    {
    $output .= "<input type=\"hidden\" name=\"item_name\" value=\"$ret_product->name\" />";
    }'

    This is returning the image alttext on the Paypal page.

    Yet when I try to recall same in another function it doesn't work. What I'd like to do is place somewhere in:

    'if($ret_product->custom_input == '1')
    {
    if(!empty($ret_product->custom_input_label))

    $var_output .= $ret_product->custom_input_label.': <input type="text" name="custom_input" value="" class="eStore_text_input" />';
    else
    $var_output .= 'Instructions: <input type="text" name="custom_input" value="" class="eStore_text_input" />';
    if ($line_break) $var_output .= '
    ';
    else $var_output .= ' ';
    }'

    ... how to do that??

    Thanks :)

    Posted 1 year ago #
  2. amin007
    Key Master

    You can't access the value of $nggImage->alttext unless the function is being called from a nextGen gallery template file and the reference to the image is passed down.

    Posted 1 year ago #
  3. darkmatter
    Member

    I created a template file and placed it in ngg gallery's view folder. The template has '<?php echo get_button_code_for_product(1); ?>' where I need the add to cart code. Product 1 is the product I want to use for all pics on this gallery.

    The template you created which has '<?php echo print_eStore_ngg_buy_now($image); ?>' is essentially calling the same eStore_misc_functions.php file where both functions are located with the difference being that get_button_code_for_product($id) refers to the variations/etc in eStore_button_display_helper.php. Is that why it's not working? Do I need to transpose all of the functions onto the same file for everything to work correctly?

    Again pardon my ignorance with php, I really hope you can help out!

    Vince

    Posted 1 year ago #
  4. amin007
    Key Master

    You can modify the "get_button_code_for_product" function in the eStore_misc_functions.php file so it takes another argument (the image reference).

    so the function definition will look like the follwoing:

    function get_button_code_for_product($id, $image='')

    Now, when you call this function from the template file you can pass the image reference like the following:

    <?php echo get_button_code_for_product(1,$nggImage); ?>

    This will allow you to get the alt text for the image in question by using the following in the "get_button_code_for_product" function:

    $nggImage->alttext

    Posted 1 year ago #
  5. darkmatter
    Member

    Thank you!

    $image='' or $nggImage='' for the image reference in the function? I'm assuming you meant $nggImage.

    Here's what I did:

    - added $nggImage='' as an argument to function get_button_code_for_product

    function get_button_code_for_product($id,$nggImage='')

    - added $nggImage to the function call in the template file

    <?php echo get_button_code_for_product(1,$nggImage); ?>

    - added $nggImage to call the image alttext in the button helper

    if($ret_product->custom_input == '1')
        {
            	if(!empty($ret_product->custom_input_label))
    			$var_output .= $ret_product->custom_input_label.': <input type="text" name="custom_input" value="'.$nggImage->alttext.'" class="eStore_text_input" />';
            else
                $var_output .= 'Instructions: <input type="text" name="custom_input" value="" class="eStore_text_input" />';
      		if ($line_break) $var_output .= '<br />';
    		else $var_output .= ' ';
        }

    Unfortunately, nothing shows up in the custom field: http://camelarae.com/galleries/i9-sports-galleries/i9-sports-flag-winter2010/test-gallery-with-purchase

    Not sure I've got the argument in the right places. Is $nggImage an actual variable that exists in a table from an ngg gallery array? I see $image in ngg's code... I'm lost :(

    Posted 1 year ago #
  6. amin007
    Key Master

    When you pass a parameter to a function the reference to it becomes the name you specify in the function's parameter list. So you could be passing the following to a function:

    $a = 2;
    $b = 3;
    sum_two_numbers($a,$b);

    Now if the function looks like the following then inside this function a and b becomes c and d respectively:

    function sum_two_numbers($c,$d)

    Anyway, you can use the same name if it makes it easier.

    Next, I was only giving you examples in my code. When you are passing the reference from the nextgen gallery template you need to use the variable name as it is used on that file. If you uses $image then you need to pass in $image like the following:

    <?php echo get_button_code_for_product(1,$image); ?>

    Posted 1 year ago #
  7. darkmatter
    Member

    I guess what I don't quite understand is the hierarchy as it relates to the position of the call to a parameter. In other words, I can have function get_button_code_for_product($id,$image='') and <?php echo get_button_code_for_product(1,$image); ?> but then if I call $image in eStore_button_display_helper.php as above with $nggImage, nothing happens.

    Do I also need to add the reference in eStore_button_display_helper.php somewhere?

    Once again, lost haha!

    Posted 1 year ago #
  8. darkmatter
    Member

    OK, I figured it out finally...

    In eStore_misc_functions.php:

    function get_button_code_for_product($id,$image)

    and

    function get_button_code_for_element($ret_product,$line_break=true,$ngg2Image='')

    and

    $var_output = get_variation_and_input_code($ret_product,$line_break,$ngg2Image);

    In eStore_button_display_helper.php:

    function get_variation_and_input_code($ret_product,$line_break=true,$ngg2Image)

    and

    $var_output .= $ret_product->custom_input_label.': <input type="text" name="custom_input" value="'.$ngg2Image->alttext.'" class="eStore_text_input" />';

    All done! http://camelarae.com/galleries/i9-sports-galleries/i9-sports-flag-winter2010/test-gallery-with-purchase

    I understand all this much better now. Thanks again for your patience in helping me out :)

    Posted 1 year ago #
  9. singhi
    Member

    Hi Darkmatter,
    im working on a site trying to do the exact same thing as you on camelarae.com.
    Im am a PHP-Newbie but ive tried to paste the your code into the eStore_misc_functions.php and eStore_button_display_helper.php and getting errors.
    It would be great to get a little "How to" from you.
    Really appreciate your help.
    Singhi

    Posted 1 year ago #
  10. darkmatter
    Member

    @singhi

    It's been a while since I looked at this... there were several steps which affected multiple files including the NGG Gallery view files. Have you made any changes in the NGG/e-Store gallery viewer located in plugins/nextgen-gallery/view ?

    Posted 1 year ago #

RSS feed for this topic

« Previous1…345…10Next »

Reply »

You must log in to post.

Tips and Tricks HQ Forum is proudly powered by bbPress

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin