Bring Your Business to Life › Support › WordPress: Popular Widget Plugin 100K downloads
Forum Replies Created
- AuthorPosts
- lch503Participant
Thanks,
Could you also make the following change to sagepay.php
in the function add_hidden_fields( $output ),
could you add a conditional statement for the lines
$crypt .= ‘BillingState=’ . $data[‘billing_state’] . ‘&’;
and
$crypt .= ‘DeliveryState=’ . $data[‘address_state’] . ‘&’;
as these are only required for the US, at the moment I must comment these out after every release.
So, for example in psuedocode
if ( currency = US dollars ) $crypt .= ‘BillingState=’ . $data[‘billing_state’] . ‘&’;
and
if ( currency = US dollars ) $crypt .= ‘DeliveryState=’ . $data[‘address_state’] . ‘&’;
Thanks!
lch503ParticipantGreat! They have indeed!
There is one issue in sagepay.php with the
do_action( ‘ims_sagepay_notice_error’, $ImStore->error, $cartid );
hook.
Note that one on the parameters is $cartid which is not set until after the if statement. Moving the line
$cartid = trim( $crypt_array[‘VendorTxCode’] );
to before the if statement
if( $crypt_array[‘Status’] != ‘OK’ ){
fixes the issue. Apart from that the hooks work great 🙂
Thanks again!
Leon
lch503ParticipantThank you,
More than happy to at my usual email address!
Leon
lch503ParticipantI have this all working now.
Thanks,
Leon
March 13, 2014 at 9:11 am in reply to: Add to Cart button does not work for each second image on each page #57093lch503ParticipantThanks!
This is good news, I have noticed this issue as well!
Leon
lch503ParticipantAlso, all http requests to the old website link to the new website at the moment, so we cannot just link to the old website for the galleries.
Leon
lch503ParticipantHello,
I have completed the CD plugin.
You can mark this as closed.
Thanks,
Leon
lch503ParticipantHello,
I have completed the CD plugin using he current hooks, therefore my request is not required. Thank you for all your help.
You can mark this as closed.
Thanks,
Leon
lch503ParticipantHello,
If I use the ims_after_add_to_cart I have to recalculate everything, and resave my data to the database. Most of the code will be nearly all copy and paste what you have, and therefore just being re-executed.
Would you please reconsider adding the hook ims_after_update_cart in the location I suggest as this would be a massive help in the creation of the CD plugin, as with this addition it is complete. (I have added it myself and it all works).
Thanks,
Leon
lch503ParticipantHello,
I have managed to implement the change in the cookie without changing your code (its all done in the extension)
Using before_post_actions I have implemented my own add_to_cart() method that is exactly the same as seen in _inc/store.php apart from changing the cookie expiry to time()+2.
Thanks!
Leon
lch503ParticipantI think this is because the before_save_cart hook passes the cart, and not the store itself. Therefore I do not have access to the global $ImStore variables, only the cart.
lch503Participantmy function linking the before_save_cart hook is:
function cd_in_cart( ){ global $ImStoreCart; if ( $ImStoreCart->cart['cderror'] = 1 ){ $ImStoreCart->cart['cderror'] = 0; } $cart = $ImStoreCart->cart['images']; foreach ( $cart as $id => $sizes ){ foreach ( $sizes as $size => $colors ) { foreach ( $colors as $color => $values ) { if ($cart[$id][$size][$color]['size'] = "CD"){ if ($ImStoreCart->cart['images'][$id][$size][$color]['quantity'] > 1){ $ImStoreCart->cart['cderror'] = 1; $ImStoreCart->cart['images'][$id][$size][$color]['quantity'] = 1; $ImStoreCart->error = __( 'Error in CD Quantity', 'ims' ); } } } } } } }
I find that if I use global $ImStore in this function I don’t have access to the $ImStore variables, but I do with the $ImStoreCart variables, hence I use that.
I cannot therefore do as you suggest and falsify the $ImStore message variable. I have tried your suggestion and unfortunately this does not work.
Thanks,
Leon
lch503ParticipantHello,
I am getting quite far now. I am working on the front end.
If the customer chooses a CD option and requests more than one of the same image on a CD I have implemented an error system where the image store throws an error “invalid cd quantity” and resets the quantity to 1.
This is implemented in the before_save_cart hook.
This is working for the most part, however sometimes the error is seen as:
“Successfully added to cartInvalid CD quantity”
In the popover. This is shown with a green background rather than red as an error usually does. If I try again the error is thrown correctly.
After some debugging I have narrowed it down to the expiry of the cookie set on line 566 in the add_to_cart() function of _inc/store.php. The line is setcookie(‘ims_message’)… If I set it to time() + 2 I don’t see the incorrect error. This is bad on my part because I am modifying your code.
Is there a correct hook I can use to unset the cookie before the message is displayed, or if not could you please create one in your next release?
Could you supply the correct code for invalidating this cookie correctly?
Note that there is also a setcookie(‘ims_message’)… line of code on line 591 in the update_cart() function in _inc/store.php if you need to add a hook.
Thanks,
Leon
lch503ParticipantI’m just using a local standard installation of MAMP for testing. I haven’t changed any of the settings under the hood, only adding a database and relocating the htdocs directory.
I find it’s only in the backend. It’s weird as it all seems to work, so I don’t really understand it either! Never mind, no point in worrying about it if you don’t get the issue, I thought it might have been something with wordpress 3.8.
Thanks for your time in trying to resolve the issue.
Merry Christmas!
Leon
lch503ParticipantI have tried with a fresh installation of WordPress 3.8, fresh database, image-store 3.4.2 and still receive the warnings.
Thanks,
Leon
- AuthorPosts