ruben |
|
---|---|
i have the shopsystem plugin running at my site, and added the prdct_extra lines to be able to add some extra photo's. how can i change the code in the shopsystem.detail.php code so it shows a "No Photo" image when the prdct_extra field is empty? i tried a little bit myself but i have no php coding skills at all
if (empty($row1['prdct_extra9']) {$shopsystem_items .= "<td width=\"200px\"><img src=\"images/geenfoto.jpg width=\"100px\" id=\"ads\" \"></td>" : '';} else {
$shopsystem_items .= "<td width=\"200px\"><a href=\"datas/users/".$cfg['plugin']['shopsystem']['shopsystem_userid']."/".$row1['prdct_extra9']."\" target=\"_blank\">
<img src=\"datas/users/".$cfg['plugin']['shopsystem']['shopsystem_userid']."/".$row1['prdct_extra9']."\" width=\"100px\" id=\"ads\" \"></a>" : '';};
|
lukgoh |
|
---|---|
You can use a callback in the tpl file. <!-- IF {WHAT_EVER_THE_IMG_TAG_IS} --> <img src="{WHAT_EVER_THE_IMG_TAG_IS}" /> <!-- ENDIF -->
Luke. |
Kingsley |
|
---|---|
or: <!-- IF {SHOPSYSTEM EXTRA LINE} --> {SHOPSYSTEM EXTRA LINE} <!-- ELSE --> <img src="{WHAT_EVER_THE_IMG_TAG_IS}" /> (e.g. no image photo) <!-- ENDIF --> |
lukgoh |
|
---|---|
<!-- IF {SHOPSYSTEM_EXTRA_LINE} --> <img src="{SHOPSYSTEM_EXTRA_LINE}" /> <!-- ENDIF --> He doesn't want to display anything if it isnt set. |
ruben |
|
---|---|
i changed some things but it still shows the code where there shouldn't be an img like this <a href="datas/users/1/"><img src="datas/users/1/" width="100px" id="ads" "> {SHOPSYSTEM_ITEMS} <!-- IF {SHOPSYSTEM_ITEMSEX4} -->{SHOPSYSTEM_ITEMSEX4}<!-- ENDIF --> <!-- IF {SHOPSYSTEM_ITEMSEX5} -->{SHOPSYSTEM_ITEMSEX5}<!-- ENDIF --> <!-- IF {SHOPSYSTEM_ITEMSEX6} -->{SHOPSYSTEM_ITEMSEX6}<!-- ENDIF --> <!-- IF {SHOPSYSTEM_ITEMSEX7} -->{SHOPSYSTEM_ITEMSEX7}<!-- ENDIF --> <!-- IF {SHOPSYSTEM_ITEMSEX8} -->{SHOPSYSTEM_ITEMSEX8}<!-- ENDIF --> <!-- IF {SHOPSYSTEM_ITEMSEX9} -->{SHOPSYSTEM_ITEMSEX9}<!-- ENDIF --> {SHOPSYSTEM_ITEMSEND} {SHOPSYSTEM_OPENCLOSED}
Added 2 hours later: already found a solution! |
|
This post was edited by ruben (2013-01-06 21:49, 11 years ago) |
lukgoh |
|
---|---|
What was your solution? |
Twiebie |
|
---|---|
He wanted to show a 'No image available' image when a product didn't have an image. |
lukgoh |
|
---|---|
Ah man, I didn't read his first post properly. At least its sorted, good job. How comes Kingsley's suggestion didn't work, because Genoa doesn't support template call backs or something? |
Twiebie |
|
---|---|
Nah, the code in the shop plugin is like this: while ($row = sed_sql_fetcharray($sql)) { // products output $shopsystem_items .= "<div id=\"shop_item\">"; $shopsystem_items .= "<div id=\"shop_image\">"; $shopsystem_items .= "<h2>".$L['shopystem']['prdcttitle']."".$row['prdct_title']."</h2><hr />"; $shopsystem_items .= "<center><a href=\"plug.php?e=shopsystem&m=detail&id=".$row['prdct_id']."\"><img src=\"datas/".$cfg['plugin']['shopsystem']['shopsystem_thumbimg']."/".$cfg['plugin']['shopsystem']['shopsystem_userid']."/".$row['prdct_url']."\" width=\"".$cfg['plugin']['shopsystem']['shopsystem_xthumb']."\"></a></center>"; $shopsystem_items .= "</div>"; $shopsystem_items .= "<div id=\"shop_desc\" style=\"width:".$cfg['plugin']['shopsystem']['shopsystem_xdesc'].";\">"; $shopsystem_items .= "<h2>".$L['shopystem']['prdctdesc']."</h2><hr />"; $shopsystem_items .= "<p><img src=\"plugins/shopsystem/img/help.png\"> ".$row['prdct_desc']."</p>"; $shopsystem_items .= "<p><img src=\"plugins/shopsystem/img/money.png\"> ".$row['prdct_price']." ".$cfg['plugin']['shopsystem']['shopsystem_money']."</p>"; $shopsystem_items .= "<p><img src=\"plugins/shopsystem/img/cart_error.png\"> ".$row['prdct_amount']." ".$L['shopystem']['prdct_amount']."</p>"; $shopsystem_items .= "<a href=\"plug.php?e=shopsystem&m=cart&id=".$row['prdct_id']."\"><img src=\"plugins/shopsystem/img/cart_add.png\"> ".$L['shopystem']['prdctaddtocart']."</a>"; $shopsystem_items .= "<a href=\"plug.php?e=shopsystem&m=detail&id=".$row['prdct_id']."\"><img src=\"plugins/shopsystem/img/magnifier.png\"> ".$L['shopystem']['prdctdetails']."</a>"; $shopsystem_items .= "</div>"; $shopsystem_items .= "</div>"; } $t-> assign(array( "SHOPSYSTEM_TITLE" => $plugin_title, "SHOPSYSTEM_OPENCLOSED" => $plugin_closed, "SHOPSYSTEM_LOGO" => "<img src=\"".$cfg['plugin']['shopsystem']['shopsystem_logo']."\">", "SHOPSYSTEM_ITEMS" => $shopsystem_items, "SHOPSYSTEM_SUBTITLE" => $shopsystem_menu, ));
|
lukgoh |
|
---|---|
Oh yeah, wow. I need to get my shop module finished so people can stop using this outdated stuff. |
Twiebie |
|
---|---|
#36729 lukgoh: How's that shop module coming along? |
lukgoh |
|
---|---|
I haven't had any time to work on it, or any of my other modules except I have started working on a project/portfolio but I have a client who needs the shop module so that should be released fully functioning in the next 2-3 weeks. |
ruben |
|
---|---|
this is what i wanted, if prdct_extra4 is empty (or now i set '0' in the form were i add the photo's) there is a 'nophoto' image showing. if($row1['prdct_extra4']=='0') { $shopsystem_items .= "<td width=\"200px\"><img src=\"images/nophoto.jpg\" width=\"100px\" id=\"ads\" ></td>";} else { $shopsystem_items .= "<td width=\"200px\"><a href=\"datas/users/".$cfg['plugin']['shopsystem']['shopsystem_userid']."/".$row1['prdct_extra4']."\" class=\"fancybox\"> <img src=\"datas/users/".$cfg['plugin']['shopsystem']['shopsystem_userid']."/".$row1['prdct_extra4']."\" width=\"100px\" id=\"ads\" ></a></td>"; };
|