Error in modify.php

Gast

#4
okay, i see it, looks like Vers 1.71
P.S.: i read, it is Vers 1.7.1  ;-)

your question:
QuoteIs this change (replacing $post['main_image'] with $main_image OK?
simple answer: NO

$post is the answer of the select to the database about the main image and this answer must be an array.
the select search for the first picture to this ITEM_ID
the image table list all images, ordered by ITEM_ID and Item position, the Picture on position 1 is your main picture. if you dont change the picture position in the image administration on the product modify-Page, all images has position = 1, the select take's then the first picture as your main picture

$post['main_image'] is the filename of this first picture to this Item_ID without file extension like *.jpg
for example
complete filename = mypicturefile.jpg
$post['main_image'] = mypicturefile

$post['main_image'] is using as image title && image alt-text

now its possible, when you have some special chars or whitespaces or extra-points in your filename, the script cannot write this and leave the database field empty, but then, you have also no image to show

at first, go to WB-settings and there to advanced settings, search nearly in the top to php error reporting, switch that point to a setting with E_ALL, after that, the error message will show in the top of the WB-Backend, so you have not to read the logfile ever and ever
(Dont forget to switch back to E_NONE, when the problem is solved)

now test on other product pages - if WB shows the error, check the image filename, showing in the backend and the image filename in the folder media/bakery/images/your-Item_id

maybe (and hope) you found some problem with special chars etc.

P.S.: $main_image was a fix variable in Bakery Vers <= 1.60, this variable is not using in the same content in the newer bakery versions

if you use $main_image like your code example, the next error message come (maybe like array_merge())- because $main_image is a arrey now

hope, you understood my bad english

if you dont found any problem's in the picture names, change the code in line 143 // modify.php like this
<img src="<?php echo $main_thumb_url?>" alt="<?php echo $MOD_BAKERY['TXT_IMAGE'?>" height="48" border="0" />




Gast


scheltel

Hi,

When I try to save the settings of a payment provider in de logs the following error occurs:

[Thu Mar 05 14:02:45.367663 2015] [:error] [pid 18919] [client 217.121.163.25:53593] PHP Notice:  Undefined index: main_image in /var/www/omnikassa.schelhaas.net/public_html/modules/bakery/modify.php on line 143, referer: http://omnikassa.schelhaas.net/modules/bakery/save_payment_methods.php

after replacing
<img src="<?php echo $main_thumb_url?>" alt="<?php echo $MOD_BAKERY['TXT_IMAGE']." "$post['main_image']; ?>" height="48" border="0" />

with
<img src="<?php echo $main_thumb_url?>" alt="<?php echo $MOD_BAKERY['TXT_IMAGE']." "$main_image?>" height="48" border="0" />

Is this change (replacing $post['main_image'] with $main_image OK?