Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Batch upload of custom field values?  (Read 5859 times)

0 Members and 1 Guest are viewing this topic.

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Batch upload of custom field values?
« on: March 20, 2005, 10:59:30 am »

Hi,
I'm looking for a way to batch upload custom field values to all the photos on my site.

http://www.urphotos.co.uk/gallery/cpg1.3.2/cpg132/index.php

At present I need to go through each file individually and add the price by using the edit description in admin mode, even although all the prices are the same.

JOhn
« Last Edit: March 21, 2005, 10:18:39 am by GauGau »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Batch upload of custom field values?
« Reply #1 on: March 20, 2005, 11:09:38 am »

If you're saying that you have a field that contains the same value for all files, it's possible to change that value for all files using the appropiate query in the database. Do you have access to edit the database?
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #2 on: March 20, 2005, 11:25:31 am »

A better example of what I am talking about can be found  at

http://www.urphotos.co.uk/gallery/cpg1.3.2/cpg132/displayimage.php?album=3&pos=0

I have the custom fields filled out in this shot with the prices.
All prices for all photos on the site are the same. So I am looking for a way to insert these custom field values to every photo on my site w/o having to go through each one manually.

I have access to the database.

Thanks,
John
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Batch upload of custom field values?
« Reply #3 on: March 20, 2005, 11:28:20 am »

Quote
You need to register to access this page. Register by hovering the "@" symbol on the navigation bar above
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #4 on: March 20, 2005, 11:41:09 am »

You have a PM
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Batch upload of custom field values?
« Reply #5 on: March 20, 2005, 12:02:00 pm »

Did TranzNDance request to be sent a PM? You're suppossed to post a test user account publicly, not sending one by PM...

Joachim
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #6 on: March 20, 2005, 12:10:52 pm »

Sorry :-[ :-[

Test account can be had here, http://www.urphotos.co.uk/gallery/cpg1.3.2/cpg132/index.php
Username.......  traNZ
password........  test

If this is not correct etiquette please let me know what is

Cheers,
John
« Last Edit: March 20, 2005, 02:43:25 pm by kartpics »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Batch upload of custom field values?
« Reply #7 on: March 20, 2005, 06:48:36 pm »

Proper etiquette is described in GauGau's signature. ;)

Sometimes I ask questions so the user will provide details to assist supporters in finding a resolution. It doesn't mean that I can offer the solution myself. So PM'ing me, or any other supporter without them requesting it, limits your chance of getting adequate help when another supporter can give it to you.
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #8 on: March 20, 2005, 07:45:03 pm »

Cheers.
Quote  "If you're saying that you have a field that contains the same value for all files, it's possible to change that value for all files using the appropiate query in the database. Do you have access to edit the database?"

I do have access to the database, but have no idea  (very little knowledge here) what the appropriate query would be, or where to find it.

Any help here would be appreciated.
John
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Batch upload of custom field values?
« Reply #9 on: March 20, 2005, 08:48:09 pm »

Nibbler posted a mod to allow upload of a csv file that might help you out.

http://forum.coppermine-gallery.net/index.php?topic=15184.msg72979#msg72979
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #10 on: March 20, 2005, 09:23:48 pm »

Here is where I've got to so far.

In the Configuration page under the "Custom fields for image description (leave blank if unused)", I have filled in each of these fields as follows,
Field 1    A4
Field 2    A3
Field 3    A3+
Field 4   30x20" poster

What I want to do now is to have each of these field's values filled in and displayed under each picture automatically;

The respective values applicable to these custom fields for all photos on my site should be
£8
£15
£20
£35

I can do this manually, but to cover all 800 photos is going to take forever. I am looking for a way to do this as a batch run.

Nibbler's post seems a bit complex, I think I'm looking for something simple, like a database adjustment, but just need pushing in the right direction. I am a newbie but I do learn pretty quickly, even for an old bugger.

John
« Last Edit: March 20, 2005, 10:11:55 pm by kartpics »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Batch upload of custom field values?
« Reply #11 on: March 20, 2005, 10:16:14 pm »

I think you are misusing the Custom Fields.

Custom fields are used to store information per picture. It makes no sense to populate the entire database with the same information for every picture.

What EXACTLY are you trying to do?  Give us the big picture, don't talk about HOW yet, we haven't determined the WHAT of what your trying to accomplish.

At this point your trying to stuff a square peg, down a round hole.
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #12 on: March 20, 2005, 10:26:54 pm »

What I am trying to do is show any viewers how much a photograph is going to cost them in any of the sizes that I offer.
Normally I would redirect them to a seperate price and size page, but feel that to have them buzzing around all over the place would be a little tedious.
Does this sound reasonable, or am  I losing it a bit?

John
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Batch upload of custom field values?
« Reply #13 on: March 20, 2005, 10:29:59 pm »

Sounds perfectly reasonable, and pretty easy to accomplish.

Lets establish if you need to do anything per-picture, that would change how I recommend doing it.

Are some prints only available in certain sizes?

Do some prints cost different amounts than other prints of the same size?

Do you intend on sending them to some kind of order page if they click on the size or price?

Have you looked at the shopping cart mods?
« Last Edit: March 20, 2005, 10:35:45 pm by donnoman »
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #14 on: March 20, 2005, 10:45:24 pm »

All prints are available in all sizes

All prints of the same size cost the same

I do intend to send viewers to an order page, but not just yet, sometime in the near future when I have worked out just how to do it.
I am taking this thing step by slow step.

I have read the shopping cart mods and this is one reason for wanting to do this.

John
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Batch upload of custom field values?
« Reply #15 on: March 21, 2005, 03:30:59 am »

you should really check out Casper's paypal mod and demo

Here's a really basic static example.

Modify the template in $pricing to suit.

in displayimage.php find:
Code: [Select]
   if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_picture, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_picture, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_picture, 'caption');
        }
    }

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $pic_html,
        '{ADMIN_MENU}' => $picture_menu,
        '{TITLE}' => $CURRENT_PIC_DATA['title'],
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
        );

replace with:
Code: [Select]
   $pricing=<<<EOT
    <table border="1" summary="Pricing Information for Prints" align="center">
  <caption>
  Pricing
  </caption>
  <tr>
    <th scope="col">Size</th>
    <th scope="col">Price</th>
  </tr>
  <tr>
    <td>A4</th>
    <td>&pound;8</th>
  </tr>
  <tr>
    <td>A3</td>
    <td>&pound;15</td>
  </tr>
  <tr>
    <td>A3+</td>
    <td>&pound;20</td>
  </tr>
  <tr>
    <td>30x20&quot; poster </td>
    <td>&pound;35</td>
  </tr>
</table>

EOT;

    $CURRENT_PIC_DATA['caption']=$pricing . bb_decode($CURRENT_PIC_DATA['caption']);

    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_picture, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_picture, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_picture, 'caption');
        }
    }

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $pic_html,
        '{ADMIN_MENU}' => $picture_menu,
        '{TITLE}' => $CURRENT_PIC_DATA['title'],
        '{CAPTION}' => $CURRENT_PIC_DATA['caption'],
        );
Logged

kartpics

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Batch upload of custom field values?
« Reply #16 on: March 21, 2005, 09:21:56 am »

Superb.
Works a treat. Now to read casper's Paypal thread.

Many thanks,
John :) :) :)
Logged
Pages: [1]   Go Up
 

Page created in 0.042 seconds with 21 queries.