PDA

View Full Version : Dynamic Mopics... where did the table "products_images" go?



llamma
04-04-2012, 08:05 AM
I'm doing a bit of work feeding products to Amazon and wanted to populate the additional images fields with the ones from mopics. I cannot find a table that includes the references to the additional product images I have. I downloaded the stock mopics contribution and see it wants to create a table called Products_images but I do not see that table in oscmax. Does anyone know where should I look?

pgmarshall
04-04-2012, 09:44 AM
The actual images are in products/ and the system simply know what the image is called and then appends the relevant path needed to display the different images.

So look in the products table for the products_image field ... then simply append the images/products/ path to it.

Regards.

llamma
04-04-2012, 09:52 AM
Thanks but I see only the first image listed there. I built my urls successfully for the main image but its the extra images that are giving me trouble. I dont see how or where those are being recorded.

If i add a new product and upload image #1 its name is in products (products_images field) but if I add 2 more images to that product I dont see where those image file names are recorded in the database.

pgmarshall
04-04-2012, 10:10 AM
Ah ha ... they are not recorded either that is why it is called dynamic_mopics! It looks for your image_name.jpg and then tries to find image_name_1.jpg, image_name_2.jpg, image_name_3.jpg until it finds a break in the sequence.

A quick slice and dice of includes/modules/dynamic_mopics.php will get you a nice sequence of images for your amazon export.

Let me know if you need a bit more help.

Regards.

llamma
04-05-2012, 04:25 AM
Well of course just like magic!

Thanks, that makes sense. That is probably a much more efficient method compared to querying the database for every photo.

My upload is working and finding the photos thanks!

llamma
04-10-2012, 09:56 AM
Okay now I have another question... I can easily build my links but if there is no photo at the end of the link Amazon fails the upload of the product.

So I just looked at each product and deleted the un necessary links in my upload file and it works fine. But I sure would like to be able to automate the thing completely without the manual step of finding how many photos per product. I could of course just upload one photo which each product has at least one photo but would like to do all the other photos as well if they exist

Can anyone come up with a "smart" way to check each product and produce either a listing of photos that exist or a number of photos per product.

pgmarshall
04-10-2012, 10:13 AM
The salient bits you need are all in the dynamic_mopics.php module ... the main bits you will need should look something like this:



$image_base = mopics_get_imagebase($product_info['products_image'], DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR);

$search = array('imagebase', mopics_match_pattern(DYNAMIC_MOPICS_PATTERN));
$replace = array($image_base, $i);

while($image_ext = mopics_file_exists(str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN))) {
$image = str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN) . '.' . $image_ext;
echo $image;
}


Regards.

llamma
04-11-2012, 07:58 AM
Thanks that helps. I guess I will be in the business of creating a new page to capture those and then be able to export. I was hoping it was already available somewhere.

pgmarshall
04-11-2012, 10:10 AM
You could write a feedmachine module to do it ... depends on how you are exporting the data to Amazon.

Is there a set format to upload to Amazon in? If so, can you post a link to it?

regards.