Pixelpost Forum

Pixelpost Forum (http://www.pixelpost.org/forum/index.php)
-   Addons (http://www.pixelpost.org/forum/forumdisplay.php?f=13)
-   -   Massive image print options editing added (http://www.pixelpost.org/forum/showthread.php?t=10202)

sergiold 02-16-2009 04:18 PM

Massive image print options editing added
 
Hi!

I've been working making a gallery to a friend (you can see it in Wiris Gallery). One of the addons I've used is the EcoSee Paypal for Pixelpost Addon.

It was really useful but I added some lines in order to copy an image print options to all the other images in the site.

As I saw in this forums, some other people was interested in this functionality so I've decided to share it.

This is how it will look like when finished all modifications:

http://img15.imageshack.us/img15/975...ificadolu4.jpg


Code modifications needed

1. Open addons/admin_paypal_cart.php

2. Copy this in line 147

HTML Code:

Apply print options to all images?        <input type="checkbox" name="change_all_images[]" />
3. Change lines 260-268:

PHP Code:

$theid intval($theid);

   
$query "DELETE FROM {$pixelpost_db_prefix}paypalcardprintoptions WHERE id_image = $theid";
   
mysql_query($query);
   foreach (
$options as $opt) {
      
$query "INSERT INTO {$pixelpost_db_prefix}paypalcardprintoptions
VALUES('" 
mysql_real_escape_string($theid) . "', {$opt['width']}, {$opt['height']}, {$opt['price']}, '" mysql_real_escape_string($opt['options']) . "')";
      
mysql_query($query);
   } 

whith this:

PHP Code:

if(!isset($_REQUEST["change_all_images"][0])){
       
$theid intval($theid);
    
       
$query "DELETE FROM {$pixelpost_db_prefix}paypalcardprintoptions WHERE id_image = $theid";
       
mysql_query($query);
       foreach (
$options as $opt) {
          
$query "INSERT INTO {$pixelpost_db_prefix}paypalcardprintoptions
          VALUES('" 
mysql_real_escape_string($theid) . "', {$opt['width']}, {$opt['height']}, {$opt['price']}, '" mysql_real_escape_string($opt['options']) . "')";
          
mysql_query($query);
       }
   }else{
       
$buscaid="SELECT id FROM {$pixelpost_db_prefix}pixelpost";
    
$result mysql_query($buscaid);
    while(
$row=mysql_fetch_row($result)){
        
$theid intval($row[0]);    
        
$query "DELETE FROM {$pixelpost_db_prefix}paypalcardprintoptions WHERE id_image = $theid";
        
mysql_query($query);
        foreach (
$options as $opt) {
            
$query "INSERT INTO {$pixelpost_db_prefix}paypalcardprintoptions
            VALUES('" 
mysql_real_escape_string($theid) . "', {$opt['width']}, {$opt['height']}, {$opt['price']}, '" mysql_real_escape_string($opt['options']) . "')";
            
mysql_query($query);
        }
    }
   } 

That's all!

Instructions

The addon works exactly as before the modifications but if the new checkbox is checked when clicking in Upload or Update image, the options will be added (OR DELETED) in all the images.

If you don't click the checkbox, the options will only affect to the image you are working whith.

I think that's all what I had to say. I hope you find this useful.


All times are GMT. The time now is 11:52 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.