Batch upload of custom field values? Batch upload of custom field values?
 

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

Main Menu

Batch upload of custom field values?

Started by kartpics, March 20, 2005, 10:59:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kartpics

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

Tranz

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?

kartpics

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

Tranz

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

kartpics


Joachim Müller

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

Joachim

kartpics

#6
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

Tranz

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.

kartpics

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

donnoman


kartpics

#10
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

donnoman

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.

kartpics

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

donnoman

#13
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?

kartpics

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

donnoman

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:

   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:

   $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'],
       );

kartpics

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

Many thanks,
John :) :) :)