Problemi in product_info.php

Questo forum è dedicato alle discussioni riguardanti le contribution per osCommerce

Moderatore: mod Generali

Rispondi
southmodel
membro Regular
membro Regular
Messaggi: 116
Iscritto il: 18/09/2003, 0:00
Località: Italia
Contatta:

Problemi in product_info.php

Messaggio da southmodel »

Ciao a tutti, ho installato questo contr.

http://www.oscommerce.com/community/con ... arch,ezier

che permete di visualizzare nel file catalog/product_info.php un "confronto prezzi, ad esempio

retail price: 89.99
our price: 45.00
you save: 44.99 or 50%

nella pagina catalog/product_info.php bisogna trovare

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>
</tr>
</table>
<?php
}
?>

da sostituire con:

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
<?php

// Begin EZier new fields contrib (Noel Latsha)

if ($product_info['products_retail_price'] != 0)
{
// Get the retail price & clean up the decimal places
$retail = ($currencies->display_price($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id'])));
$strlen = strlen($retail);
if (NEW_FIELDS_DECIMAL == 0) { ($strlen = ($strlen - 3)); } // Set the decimal places
if (NEW_FIELDS_DECIMAL == 1) { ($strlen = ($strlen - 1)); } // We don't need em here
$retail = substr(($currencies->display_price($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id']))),0,$strlen) ;

// Couldn't think of a better way to do the next part, if you can think of one, let me know...

if ($new_price = tep_get_products_special_price($product_info['products_id']))
{ // If there is a special ... Special Overrides customer discount...
$our = ((tep_get_products_special_price($product_info['products_id'])));
$save = ((($our) / ($product_info['products_retail_price'])) * 100);
$our = ($currencies->display_price($our,tep_get_tax_rate($product_info['products_tax_class_id'])));
$strlen = strlen($our);
if (NEW_FIELDS_DECIMAL == 0) { ($strlen = ($strlen - 3)); } // Set the decimal places
if (NEW_FIELDS_DECIMAL == 1) { ($strlen = ($strlen - 1)); } // We don't need em here
$our = substr(($currencies->display_price($new_price,tep_get_tax_rate($product_info['products_tax_class_id']))),0,$strlen);
}

if ((strstr($customer_discount, "-") != 0)) // && ((tep_get_products_special_price($product_info['products_id'])) == null))
{ // If there isn't a special, but still a customer discount... We'll need those decimals....
$our = ($product_info['products_price']);
$our = $our - $our * abs($customer_discount) / 100;
$save = ((($our) / ($product_info['products_retail_price'])) * 100);
$our = ($currencies->display_price_nodiscount($our,tep_get_tax_rate($product_info['products_tax_class_id'])));
} // End cust discount

if ((strstr($customer_discount, "-") == 0) && ((tep_get_products_special_price($product_info['products_id'])) == null))
{ // Just a regular price
$our = ($product_info['products_price']);
$save = ((($our) / ($product_info['products_retail_price'])) * 100);
$our = ($currencies->display_price($our,tep_get_tax_rate($product_info['products_tax_class_id'])));
$strlen = strlen($our);
if (NEW_FIELDS_DECIMAL == 0) { ($strlen = ($strlen - 3)); } // Set the decimal places
if (NEW_FIELDS_DECIMAL == 1) { ($strlen = ($strlen - 1)); } // We don't need em here
$our = substr(($currencies->display_price($product_info['products_price'],tep_get_tax_rate($product_info['products_tax_class_id']))),0,$strlen);
} // End of regular price

$save = (100 - $save);
$save = round($save); ?>
</td>
</tr>
</table>
<?php
echo TEXT_PRODUCTS_RETAIL_PRICE_INFO . $retail ;
echo TEXT_PRODUCTS_PRICE_INFO . $our;
echo TEXT_PRODUCTS_SAVE_INFO . $save . '%</font>'; }
} else { ?>
</td>
</tr>
</table>
<?php
}
// End EZier new fields contrib (Noel Latsha)

?>

in effetti funziona, se ho inserito il nuovo prezzo nella scheda articolo in admin appare il "confonto prezzi", ma se non ho inserito il prezzo di confonto la pagina è completamente "sballata", ho fatto diverse prove ma non riesco ad ottenere un buon risultato, ad esempio se dopo

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

lascio

</td>
</tr>
</table>


succede esattamente il contrario, gli articoli normali vengono visualizzati correttamente, gli altri sfalsati.....

aiuto.......
Rispondi