[cpg1.4.x]: Shopping cart (new version) - Page 8 [cpg1.4.x]: Shopping cart (new version) - Page 8
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[cpg1.4.x]: Shopping cart (new version)

Started by Stramm, December 21, 2008, 11:43:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Stramm

Quote from: tinorebel on May 13, 2009, 11:33:12 AM
Hallo to all readers, big up to Stramm for this excelent plug-in.

I am using this shop on my website, a small photostock selling images, with good resoults.
I just thought it would be great to have a link in the e-mail sent to the clients if they want to pay with pay-pal.
Is it possible to include in the e-mail the link to pay-pal?

I dont understand coding enoughf but maby it could be an easy and usefull mod.
If someone can give me a hint it would be greatly appreciated.



In photo_shop_checkout.php find the part that generates the paypal code right after
//pay with paypal

Here you'll see the shop looping through all basket items and creating form fields. At the end of the block it adds these form fields and a submit button to the variable $msg_box_txt. The same that gets added to the message box save in another variable. Let's call it $add_paypal_to_user_email

Now find the function photoshop_email_the_user {} and add the newly created variable to the globals.
To the $template_vars array add
'{PAYPAL_BUTTON}' => $add_paypal_to_user_email,


Open the language file and edit the variable $lang_photoshop_email_order ... add {PAYPAL_BUTTON} where the paypal button should appeare.

A problem could occur though... the messages are sent in plain text. So you'd need to switch to html.
in the function photoshop_email_the_user {}
change
if(cpg_mail($user_info['user_email'], $subject, $mail_body)) {

to
if(cpg_mail($user_info['user_email'], $subject, $mail_body, 'text/html')) {


However it might be that you'll have to edit the mail template as well (make it html mail compatible... header, html tags eg. <br>)

genesisncc

Quote from: Stramm on May 14, 2009, 12:06:16 PM
Pretty easy.... edit photo_shop_checkout.php

before
//pay by wire
add
if ($CONFIG['photo_shop_cc_enable'] && $order_price > 0) {
$msg_box_txt .= <<<EOT


EOT;
}


Between the EOTs write the html necessary for your billing system. Have a llok at the paypal and google versions. These should teach you what to do.
Finally enable Credit Card payment in the shop config.


Thanks Stramm

I just have one problem the HTML Script Worldpay gave me is below, but i think its more for static payment options like if you have a buy now button on your web page where the price stays the same. How can i populate the script with the final price from the shopping cart as this will be different every time?

--

<!-- The first line of code specifies the URL for our test environment.-->

<form action="https://select-test.worldpay.com/wcc/purchase" method=POST>

<!-- This next line contains the testMode parameter - it specifies that the submission is a test submission -->
<input type=hidden name="testMode" value="100">

<!-- This next line contains a mandatory parameter. Put your Installation ID inside the quotes after value= -->
<input type=hidden name="instId" value="231463">

<!-- Another mandatory parameter. Put your own reference identifier for the item purchased inside the quotes after value= -->
<input type=hidden name="cartId" value="Online Gallery">

<!-- Another mandatory parameter. Put the total cost of the item inside the quotes after value= -->
<input type=hidden name="amount" value="50.00">

<!-- Another mandatory parameter. Put the code for the purchase currency inside the quotes after value= -->
<input type=hidden name="currency" value="GBP">

<!-- This creates the button. When it is selected in the browser, the form submits the purchase details to us. -->
<input type=submit value=" Buy This ">

</form>

Stramm

variables that may be from interest for you

$shipping_price  - holds shipping
$item_price  -  total price
$order_id  - hold the order id

use it in brackets {} within EOT

genesisncc

Quote from: Stramm on May 17, 2009, 10:15:16 AM
variables that may be from interest for you

$shipping_price  - holds shipping
$item_price  -  total price
$order_id  - hold the order id

use it in brackets {} within EOT

Where do i find photo_shop_checkout.php?

Sorry i am a new to this

Many thanks


Stramm


genesisncc

Quote from: Stramm on May 14, 2009, 12:06:16 PM
Pretty easy.... edit photo_shop_checkout.php

before
//pay by wire
add
if ($CONFIG['photo_shop_cc_enable'] && $order_price > 0) {
$msg_box_txt .= <<<EOT


EOT;
}


Between the EOTs write the html necessary for your billing system. Have a llok at the paypal and google versions. These should teach you what to do.
Finally enable Credit Card payment in the shop config.


Hello Stramm

Many Thanks for giving me the hints and tips required to get my WorldPay installation up and running.

Any advice for people wanting to use WorldPay you may follow what i did below?

--

I looked at the Google Checkout setup and used that for the WorldPay info. I used the following script from WorldPay which i added into the photo_shop_checkout.php instead of the Google script i deleted it and pasted in the WorldPay one. It was very similar:

if ($CONFIG['photo_shop_google_enable'] && $order_price > 0) {
$msg_box_txt .= <<<EOT
<form method="POST" action="https://select-test.worldpay.com/wcc/purchase">
    <input type="image" name="Worldpay Checkout" alt="Fast checkout through WorldPay" src="http://www.genesisphotographers.org.uk/images/payment_cards.gif?merchant_id={$CONFIG['photo_shop_google_id']}&w={$CONFIG['photo_shop_google_button_width']}&h={$CONFIG['photo_shop_google_button_height']}&style={$CONFIG['photo_shop_google_button_style']}&variant=text&loc={$CONFIG['photo_shop_google_button_loc']}"  height="74" width="164"/>

<input type=hidden name="testMode" value="100">
<input type=hidden name="instId" value="YOUR ID">
<input type=hidden name="cartId" value="{$order_id}">
<input type=hidden name="amount" value="{$order_price}">
<input type=hidden name="currency" value="GBP">

<input type=submit value=" Pay Now ">
</form>

EOT;
}
   

I then just uploaded an image to be displayed on the checkout page next to the "Pay Now" button "payment_cards.gif"

Now if i want to dissable WorldPay i just go into the Shop Config and dissable the Google Checkout. Not the most ideal way of doing it but i don't know enough about re-programming Coppermine to change the Google Checkout settings in the Config. Or adding another option just for WorldPay.

jjinks

How do I change the PayPal email address for Photo Shop?
I tried changing the admin email in main config but didn't work.
Please Help!!!

Stramm


hunterjo2

Hi Stramm.

Excellent Mod!  I need to know how to get the cart to fit within the template.

www.rallyimage.com/gallery/index.php.

The user has to scroll over to see the cart totals.  I have managed to move the buttons but I cant get the cart to resize by modifying the table properties in photo_shop_cart.php

Anyway any guidance would be appreciated.

Joe

jjinks

Wow, fast reply. Thanks!!

I thought I had latest version but can't find in config.
I'm not one to post without looking through past posts or config.

Here is link to screen capture:
http://bswildlife.com/images/shop-config.png

camster

This seems to be the most relevant thread so I hope I got it right. I've installed the photo_shop plugin and the config seems to be working great. However I'm attempting to set up IPN and photo downloads after purchase and am getting an error.
- I've enabled IPN on my paypal merchant account.
- In my photo_shop config> General settings panel I've enabled "Enable photo downolads after purchase", as well as the other options
- In my photo_shop config> PayPl Support settings panel, I've entered that PayPal merchant email into the email field.
  The rest of the settings I left as default except for the PayPal form URL. I changed it to live address as I was having problems with the sandbox.

I also noticed the administrator can click on the "orders" button and download the images purchased but normal users dont have the download link to the orders they have purchased. If I could get download links in the users account thats all I would need.

I tried a live buyer test and the photo_shop linked the user to the paypal login and the cart was fine after login. The problem is when the user clicks on Pay Now I get "An internal Server Error"


Maybe this is a PayPal IPN issue I'm not sure but if someone could help me narrow down the problem I'll know where to look.

Thanks

Stramm

Quote from: jjinks on May 28, 2009, 12:14:37 AM
Wow, fast reply. Thanks!!

I thought I had latest version but can't find in config.
I'm not one to post without looking through past posts or config.

Here is link to screen capture:
http://bswildlife.com/images/shop-config.png

Use the latest version of the shop

Stramm

Quote from: hunterjo2 on May 27, 2009, 08:17:56 PM
Hi Stramm.

Excellent Mod!  I need to know how to get the cart to fit within the template.

www.rallyimage.com/gallery/index.php.

The user has to scroll over to see the cart totals.  I have managed to move the buttons but I cant get the cart to resize by modifying the table properties in photo_shop_cart.php

Anyway any guidance would be appreciated.

Joe

I think it's cause of the right side menu. The shop creates a new table and uses the width value from config. However that's including that menu. You'll have to edit that in photo_shop_cart.php

find
starttable('100%', $lang_photoshop['cart'], 1);

and change 100% to whatever fits (if set width is eg. 800 px and the menu needs 200 then 800-200 = 600 -> instead of 100% use 600)

Stramm

Quote from: camster on May 28, 2009, 12:59:00 AM
I also noticed the administrator can click on the "orders" button and download the images purchased but normal users dont have the download link to the orders they have purchased. If I could get download links in the users account thats all I would need.

Shop config -> Shopping Cart General -> Enable -My Orders- button  (yes)

I tried a live buyer test and the photo_shop linked the user to the paypal login and the cart was fine after login. The problem is when the user clicks on Pay Now I get "An internal Server Error"


Maybe this is a PayPal IPN issue I'm not sure but if someone could help me narrow down the problem I'll know where to look.

IPN, even if setup wrong, never caused an internal server error on the paypal site when I tested the shop. Try the sandbox before going life. Wait a few hours it maybe a temp paypal problem.

camster

Shop config -> Shopping Cart General -> Enable -My Orders- button  (yes)
Thanks Stramm. I do have the my orders button turned on and the orders do show but there is no link to download the image.

However I've narrowed down the problem. After purchase I recieve an email from paypal saying the IPN failed with the following error message.
I think whats happening is the IPN is failing to notify photo_shop the order has been paid therefor the "P" (paid) icon in the order is not showing as paid. I'm assuming once I get IPN working the order will show as paid and the link image will show. I checked the PayPal IPN maual and as far as I know all I have to do is enable IPN, if theres something specific I need to do to photo_shop or if theres documentation somewhere here on how to set up the IPN for photo_shop please let me know. The following is the IPN error message:

Bad order (PayPal says it's invalid): HTTP/1.1 200 OK
Date: Thu, 28 May 2009 10:33:51 GMT
Server: Apache
Set-Cookie: cwrClyrK4LoCV1fydGbAxiNL6iG=aeJ2MW1YwgMw2BuNFDN29JHiRnVPANy9PPIvkh05R_-rWOIaQGCWyg7HdKtFJzLljkQUFnl70htifeWlEUTzuVgFPjBI6112IX7GcUStXJibaReeghCOd97cPWGWcYcDRaq8C0%7c6-OipjYmoTiUH5qmrcfnrrU5PZFK8FZOkxFZOMZ67SBmERfuzECaD8N2VU9AjOZrYIWP3m%7cxcRlqhJeW4mlPBHi9lL_J03kD3RjUsJZnCrFqLgztd-WOfsFe9RYBvNuj2MtrbvU03U1KG%7c1243506832; domain=.paypal.com; path=/
Set-Cookie: cookie_check=yes; expires=Sun, 26-May-2019 10:33:52 GMT; domain=.paypal.com; path=/
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/
Set-Cookie: navlns=0; expires=Wed, 23-May-2029 10:33:52 GMT; domain=.paypal.com; path=/
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

7
INVALID
0

camster

..just one other piece of info.
On my IPN settings for the Notification URL (listener) i have it set as:
http://www.zenstream.net/imagestream/
(imagestream is the root folder of coppermine) maybe I have to add the plugins/photo_shop/ to the URL?

Thanks

Stramm

Invalid means Paypal didn't verify the order. Usually currency doesn't match (set within paypal and the shop) or your merchant email is invalid (check for spaces).

Btw., the email's from the shop plugin.

camster

Thanks Stramm

-I checked my currency in the shop and my PP merchant account and they both match to CAD

-I double checked my email listed in the photo_shop plugin setting "Your PayPal merchant email address "
with my actual PP merchant primary email and they both match with no spaces or weird characters.

I tried again and everything goes through from start to finish except I get the same email with the "invalid", code I pasted in my previous message.
Any other possibilities to fix this? or maybe its a paypal issue?

Thanks

Stramm

Create a new merchant... if the order IDs are already used once you get an invalid, too.
And of course it's a PayPal thing as PayPal sends the 'INVALID'. However it may have to do with the shop setup.

camster

Ok I set up an new Merchant Account in Sandbox with IPN enabled, buyer is set up with instant payment. Also set up a new user in photo_shop.

Purchase process went through just fine but I'm still getting the same problem. The buyer recieves the email reciept but when the user logs in to photo_shop and clicks on "My Orders" the order is listed but is shown as not paid and the there is no link to download the image.  I've attached a screenshot here.

I dont recieve an IPN error in sandbox as I did on a live test.

I've attached a screenshot of my P_S settings


Thanks