Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2   Go Down

Author Topic: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05  (Read 40526 times)

0 Members and 1 Guest are viewing this topic.

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« on: December 16, 2005, 11:10:53 pm »

Finally!

The first Client-side paypal mod for Coppermine. (Although very easy to install,  html/php familiarity is required to customize this mod successfully.) 

What's a client-side paypal mod? 

It's a 3rd party paypal mod that has the shopping cart on your website that stores all purchase information in a cookie on your client's computer until s/he is ready to finalize his/her order.  ONLY then does the client actually interact with paypal.  It allows your client to purchase any quantity of an item and up to 15 items before having to interact with paypal.  Since your client only interacts with paypal once during their entire transaction, it is extremely fast and much more secure than the standard server-side paypal mods to date.  As such, it provides a seemless and very professional interface between your coppermine gallery and paypal.

As a cookie driven script, we can now offer many of the features that have only been available through 3rd party ecommerce packages that cost $30 or more per month.  These features include:

  • Single item percentage discounts for large quantities of the same item.
    Single item percentage discounts for large quantities of different items.
    Single item, quantity-based amount (1 for $5, 2 for $9, etc.).
    Single item handling charges (added to total purchase price).
    Single item shipping charges (added to total purchase price).
    Percentage or dollar value COUPON discounts (applied to total purchase price).
    Quantity or dollar value based discount (applied to purchase price).
    Quantity based handling charges (applied to total items ordered).
    Dollar value based shipping charges(applied to total purchase price).
    Percentage-based shipping charges, may be a sliding scale percentage based on amount purchased.
    Quantity-based shipping charges (Based on total number of items purchased).
    Weight-based shipping charges (lbs or kg on accumulated purchases).
    Minimum order settings may be established (amount or quantity).
    An item's min/max quantities may be set.
    User-selectable sales tax rates.
    Various FORM elements to generate necessary PayPal descriptions fields.
    Select - add value to description and alter price.
    Select-multiple - add value to description and alter price.
    Checkbox - add value to description and alter price.
    Radio - add value to description and alter price.
    Text - just add value to description field (no price altering).
    Textarea items are NOT processed.
    Product categories where items within a given category may receive special treatment (discounts, etc).

You control which options are on your cart from the cseset.js file.

This is a very sophisticated, highly complex, paypal mod.   If you only need something simple use my previously uploaded paypal mod.

This mod can be installed as buttons under your intermediate image display, as links in the image information block, as buttons on the nav bar, or as a combination of two or all three options.

You can see this mod in action at my website (the first two installation options are employed here):   http://www.artistsinhawaii.com/evj/index.php?theme=singapore

To see how all three installation options look, try this link:
http://www.artistsinhawaii.com/evj/index.php?theme=classic


This mod includes the following files:

ecart1.gif < -- navbar button1
ecart2.gif < -- navbar button2
csecards.gif < -- credit card image for cart
cseprint.gif < -- printer icon for cart
cseset.js < -- admin controls for cart.
csecart.js < -- javascript to run cart.
csecart.php < -- client-side cart.
custom_mounts.php < -- user interface for custom mounts of pictures.
standard_mounts.php < -- user interface for standard mounts of pictures.
CS_Paypal_Instructions.html < -- full installation and modification guide


All gif files must be copied into your coppermine/images folder.
The remaining files, with the exception of the instructions,  must be copied into your coppermine root directory.


Dennis
« Last Edit: December 18, 2005, 09:26:57 pm by madeinhawaii »
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Squideshi

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #1 on: December 21, 2005, 12:06:30 am »

I noticed that in one of your previous posts you indicated that you were unaware of any way to use Paypal to automatically add users to Coppermine groups; however, this new modification was recently released this past Friday.  Can this modification be used to do this?

Squideshi
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #2 on: December 21, 2005, 03:09:16 am »

I noticed that in one of your previous posts you indicated that you were unaware of any way to use Paypal to automatically add users to Coppermine groups; however, this new modification was recently released this past Friday.  Can this modification be used to do this?

Squideshi

I haven't seen this feature/mod.  Where did you see it?

Dennis
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Squideshi

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #3 on: December 21, 2005, 08:48:40 pm »

I'm sorry.  I wasn't very clear.  I haven't seen a mod that does this, I was asking if this new mod, released on Friday, was capable of doing this.  The release came after your previous post, so I thought you may have included this functionality in this new mod.  From your response, I am guessing that that answer is no.  Does this make sense?
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #4 on: December 21, 2005, 09:05:02 pm »

Ah, but you're talking about a subscription paypal mod, right.  This one is not a subscription mod, but a very complex, full-featured paypal shopping cart and paypal mod combo. Pretty much like oscommerce and all those other third-party paypal carts that charge users of their paypal mod a monthly subscription just to use their carts.  This one does most of the same and sometimes a little more... for free. It can save users of those types of services $360 a year or more.


Dennis
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
Found bug & fixed it
« Reply #5 on: January 03, 2006, 06:07:09 pm »

Quote
It allows your client to purchase any quantity of an item and up to 15 items before having to interact with paypal.

If I understood the Installation correctly, the limitation to 15 different items each purchase is because of the cookie size.
Is there no possibilty to raise the amount of items? What will happen if a customer wants to purchase - let's say - 20 different items?



Then, I found a bug, please let me explain:

* I installed CPG 1.4.3 using the "Classic" theme. No changes made so far. Works great and stable


* I added the PayPal Mod and got a Parse error:
Parse error: parse error, expecting `')'' in /mnt/ja1/08/908/00000011/htdocs/photoarchive143/themes/classic/theme.php on line 34

Line 34 in theme.php says:
Code: [Select]
$chars = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $CONFIG['forbiden_fname_char']);
There it says " ' " instead of ' ' '.
I changed it and the problem is solved.


Sonja

Edit: Added the bug fix to this post.
« Last Edit: January 03, 2006, 07:47:12 pm by SonjaSt »
Logged

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
Can't upload photos anymore - get funny comment
« Reply #6 on: January 03, 2006, 08:02:13 pm »

Since installing the Mod I can't upload photos anymore.

This is what I do:
I go to Upload file, choose the file, upload it.
CPG obviously uploads the file.
After a few seconds CPG forwards me to the site where I choose the categorie/album in which I want to place the photo. There, I can't see the thumbnail of the photo anymore (just a red cross, I am currently using Internet Explorer).
I choose an album, add title, description, keywords. After hitting the "Continue" button, I get this funny message:
(http://img247.imageshack.us/img247/2050/filenotplaced2qc.jpg)

Did I place it or did I not place it???

No, CPG did not upload the file. It is not there.

Is this another bug or my fault? I am still checking the code but did not find the error so far.

Sonja
Logged

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
standard_mounts.php and custom_mounts.php in 2 languages?
« Reply #7 on: January 03, 2006, 08:51:49 pm »

Dennis,

right now the Mod works with only one language - english.
This means that even if the user switch to another language, let's say spanish, the shopping cart still is english.

Do you see any possibility to create 2 standard_mounts.php (for example standard_mounts_eng.php for english and standard_mounts_esp.php for spanish) as well as 2 custom_mounts.php and link them with the language file?

Just thinking...
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #8 on: January 04, 2006, 12:54:44 am »

Sonja,

Thanks for pointing out the error in the string replace code.  I'll make sure to replace that in future updates. 

The code for installing this mod shouldn't affect the upload and batch add features of coppermine.  Try uploading using a different theme. (Since this mod is self contained in your theme.php file)  If the problem still exists, then it's somewhere else.

You can increase the value of 15 to 20, provided the descriptions of each item added to the cart is abbreviated sufficiently enough so that your cookie doesn't runneth over.  That really is the only limitation.  But 15 different items already creates a pretty long shopping cart page. 20 would make it 33% longer.   To change this limitation, look into your csecart.js file and search for this line:

Quote
var cmax  = 15;            // max items in cart

change the value to 20.


Insofar as creating carts for different languages, I'd probably defer to switching files in lieu of using the language file for this mod,  simply because of its complexity.  The csecart.php file itself would require translations in 70+ areas.  I had a list prepared earlier, just can't seem to find it.  I'll try to find it.   How one would go about this would be based on individual preferences, I think.

Since the entire paypal file is in php, you can use a simple if/else routine to decide what language certain text will appear in.  Just under your last if/else statement in standard_mount.php or custom_mount.php you could declare variables based on the users language to replace blocks of text appropriate to the users language.

Use the form:  (You can add all the <tr>s and <td>s as necessary to complete the block or create separate if/else statements for each block of text and just replace each text section using a different defined variable.  The defined variable in the example below is $quote.)

Quote
if ($USER['lang'] == 'german') {$quote = "
   Willkommen <br /><br />
   Add what text you want in German.
   "}
elseif ($USER['lang'] == 'spanish') {$quote =  "
   Bienvenido<br /><br />
   Add what text you want in Spanish.
  "}
else {$quote = "
   Welcome<br /><br />
   add what text you want in English.
"}

Then replace the "Buy with Confidence" section with your newly defined variable '$quote'.    Just be careful not to use (") in the text section if you use (") to embrace the entire block.

Dennis

Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #9 on: January 05, 2006, 10:08:11 pm »

Dennis, you wrote:
Quote
The code for installing this mod shouldn't affect the upload and batch add features of coppermine.  Try uploading using a different theme. (Since this mod is self contained in your theme.php file)  If the problem still exists, then it's somewhere else.
I did not find the error so I decided to delete the whole database with the PayPal addition and start anew. Before I install the Mod permanently, I tried to preview the Mod by changing the URL located in my address bar from
3w.mywebsite.com/photoarchive143/displayimage.php?album=random&cat=0&pos=-2
to
3w.mywebsite.com/photoarchive143/standard_mounts.php?album=random&cat=0&pos=-2
just as you recommend in your instructions.
The intermediate picture shows up but not the PayPal shopping cart addition. Nor does the button Display/hide file information work anymore?
How can that be? I did not change the code. I copied the gif files in the CPG/images and themes/classic/images folders and the remaing files to the root directory - just as you write in your instructions.

Well, since I have already an error in the "basics" I wonder if it make sense if I continue to install the Mod permanently?
What do you recommend?
Is there anybody else out there who installed this Mod? It has been downloaded 22 times. Does somebody has the same problems? Or does it work properly?

Thanx,
Sonja
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #10 on: January 10, 2006, 08:48:42 am »

Sonja,

Sorry for the delay in responding, my broadband modem went kaput on me.  I guess I forgot to mention in the instructions that the "info" or ( i ) feature doesn't work in the custom_ and standard_mount.php displays.  The icon is left there to visual consistency.  The feature works when the user returns to the "browse" mode.  I simply didn't feel that the info added any benefits to the purchase page. One would suspect that the user first  read that section before opting to view the purchase information.


As mentioned in the first post, this is the mod that is running on my site.  I've been using it for a couple of months now.  A somewhat simplified version is being used at http://www.posterandprintgallery.com/gallery/index.php?cat=0.

Dennis


Dennis 
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

krodgers

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #11 on: January 25, 2006, 11:36:24 pm »

dennis,

wanted to say I like the layout and such, but seems even if I change the error that sonja noticed I still cant get it to get past that line 34 error.  Was just wondering when you think that an update to this will be released.  I am looking forward to its possiblities

kendall
Logged

SonjaSt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 47
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #12 on: January 26, 2006, 10:28:20 am »

I am still struggling, too.

The version Dennis is using on his website (several sizes to choose from, each size has the same price) would be just perfect for me - but I just can not make it work.

Sonja
Logged

krodgers

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #13 on: January 27, 2006, 01:40:43 am »

same here I like the layout.  What I am looking in doing with it is having one button for just prints and the other button will be used if they want to get the print framed.
Logged

tgontz

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #14 on: January 27, 2006, 07:30:00 pm »

I am having some problems with this mod.

Like SonjaST, I too replaced displayimage.php with standard_mounts.php to "preview this mod," but no PayPal buttons showed up when I hit enter.

So I decided to go ahead and install the mod. I am using a copy of the Classic theme. When I copied and pasted the following below the if define('THEME_IS_XHTML10_TRANSITIONAL',1);  line, I added the following just like in the instructions:
Code: [Select]
function replace_forbidden2($str)
{
  static $forbidden_chars;
  if (!is_array($forbidden_chars)) {
    global $CONFIG, $mb_utf8_regex;
    if (function_exists('html_entity_decode')) {
      $chars = html_entity_decode($CONFIG['forbiden_fname_char'], ENT_QUOTES, 'UTF-8');
    } else {
      $chars = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $CONFIG['forbiden_fname_char']);
    }
    preg_match_all("#$mb_utf8_regex".'|[\x00-\x7F]#', $chars, $forbidden_chars);
  }
  /**
   * $str may also come from $_POST, in this case, all &, ", etc will get replaced with entities.
   * Replace them back to normal chars so that the str_replace below can work.
   */
    $str = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;','&nbsp;','&#39;'), array('&', '"', '<', '>', ' ', "'"), $str);;

  return str_replace($forbidden_chars[0], ' ', $str);

}


$album2 = $HTTP_GET_VARS['album'];
$pos2 = (int)$HTTP_GET_VARS['pos'];
$cat2 = isset($_GET['cat']) ? (int)$_GET['cat'] : 0;

After doing this, I get a blank page when I try to access my gallery. Do I need to put something at the end that is not shown in the instructions?

To sort of get the mod to work (by that I mean to at least get my gallery to show), I left the above code out but pasted the code for:
 To install this mod as buttons under the intermediate image:

After doing this, the buttons show up (Standard Mounts, Custom Mounts, Continue Browsing), but when I click on any of them, I get the message, "The selected album/file does not exist !"

Any ideas?
Thanks!
Logged

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #15 on: January 28, 2006, 10:32:09 pm »

Here is how to fix the line 34/35 error:

Find this line:
Code: [Select]
$chars = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $CONFIG['forbiden_fname_char']);

and replace with this:
Code: [Select]
$chars = str_replace(array('&', '"', '<', '>', ' ', '"'), array('&', '"', '<', '>', ' ', '"'), $CONFIG['forbiden_fname_char']);

should be all good.. the real problem was that he had '''  instead of '"'  no biggie.. happens to everyone..
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

tgontz

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #16 on: January 29, 2006, 03:28:15 am »

That did the trick!

Thank you very much!
Logged

zac

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 153
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #17 on: January 29, 2006, 05:29:27 am »

this looks great and i finally upgraded to 1.4.3 so i tried the install but it is a big mess.  I get error messages all over my page like:

Code: [Select]
Fatal error: Call to undefined function: replace_forbidden2() in /home/zacfolk/public_html/shop/standard_mounts.php on line 141
any ideas on what i screwed up ?

ooop ... nevermind what fareforce said fixed my problem too :)
Logged

zac

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 153
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #18 on: January 29, 2006, 08:36:36 am »

Dennis this is a really great modification... thanks you so much for sharing this.  I am confused about how you called up the different options for differnt types of prints.  In your examples you have different options for Squares and panormas.  How does your hack recognize these variables? 

o.k. i found it in the admin config ..

 and this is helpful from your docs.
Quote
If you need to use a custom description field other than the first field, you will have to change the "$user1" variable in the: if ($user1=="Panoramics"||$user1=="panoramics") line of standard_mounts.php and custom_mounts.php to $user2, $user3, or $user4, as appropriate. (The same applies to the if ($user1=="Squares"||$user1=="squares") and if ($user1=="Standards"||$user1=="standards") lines of the same code block. Edit the if/else block as is appropriate to your needs, in order to set pricing. If the entry in the assigned description field does not match any of words, pricing will default to the last if/else options in that block of code.
« Last Edit: February 10, 2006, 01:23:32 am by zac »
Logged

krodgers

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: A client-side Paypal Mod for Cpg 1.4x - released 12-16-05
« Reply #19 on: January 29, 2006, 10:46:03 pm »

I am hoping that his new mod will include the mod from other paypal where you can acutally do the pricing edits within coppermine without taking a chance on making mistakes on code.
Logged
Pages: [1] 2   Go Up
 

Page created in 0.032 seconds with 20 queries.