Skip to main content

$product = $productClass->get($product_id); is accesssing the wrong product

3 hours 56 minutes ago #100000788 by Markus Schnier
-- url of the page with the problem -- : www.2-rad-schwede.de/
-- HikaShop version -- : 6.8.2 Business
-- Joomla version -- : 5.4.10
-- PHP version -- : 8.4.28
-- Browser(s) name and version -- : Firefox 160.0

Hi,

Im using a site module and Sourcerer to calculate financing options as part of the product description. I access the product price via the product based on the product_ID. The problem is that it's not the presented product.

Also strange. The related products (also presented via a site module) are also based on the wrong product and not on the shown one. 

On my test site it's working but in production not. For test purposes I show some product details in the Finanzing tabs on the product site. 

Any idea what is going wrong.

Thanks ,
Markus


Sourcecode : 
Code:
<p><br /><strong>Ratenkredit – Der flexible Kredit ab 0% Zinsen</strong><br />Beim Ratenkredit sind Sie absolut individuell unterwegs. Eine Finanzierung wie für Sie gemacht. Wählen Sie aus verschiedenen Finanzierungsalternativen - ab einem Nominalzins von 0% und Laufzeiten bis zu 48 Monaten – ganz auf Ihre spezielle Situation und Bedürfnisse zugeschnitten.</p> <p>&nbsp;</p> {source raw="true"} <?php // HikaShop laden if (!@include_once(JPATH_ADMINISTRATOR . '/components/com_hikashop/helpers/helper.php')) {     return; } // Aktuelle Produkt-ID ermitteln $product_id = (int) hikashop_getCID('product_id'); $RadPreis = 0; if ($product_id > 0) {     // Produkt direkt aus HikaShop laden     $productClass = hikashop_get('class.product');     $product = $productClass->get($product_id);     if ($product) {         // Produktpreis inklusive HikaShop-Rabatten ermitteln         $currencyClass = hikashop_get('class.currency');         $ids = array($product_id);         $options = array('no_discounts' => false);         $currencyClass->getProductPrices(             $product,             $ids,             $options         );         // Endgültigen Bruttopreis übernehmen         if (!empty($product->prices)) {             $RadPreis = (float) $product->prices[0]->price_value_with_tax;         }     } } echo " Rad: "; echo $product->product_name; echo " / Code: "; echo $product->product_code; // Ab hier bisherige Berechnung if ($RadPreis > 0) {     $Kredit6Rate = $RadPreis / 6.000114298777;     $Kredit6Zins = 0;     $Kredit12Rate = $RadPreis / 11.7556824543724;     $Kredit12Zins = $RadPreis / 48.0263157894737;     $Kredit36Rate = $RadPreis / 33.9553686934023;     $Kredit36Zins = $RadPreis / 16.6959887403237;     echo "<small><ul>";     echo "<li><strong>0% Ratenkredit mit 6 Monaten Laufzeit<br></strong>";     echo "Bei einem Nettodarlehensbetrag von " . number_format($RadPreis, 2, ',', '.') . " € entspricht dies einer monatlichen Rate von " . number_format($Kredit6Rate, 2, ',', '.') . " € mit einem Sollzins (p.a. fest) von 0% und einem Eff. Jahreszins von 0%. Zinsen insgesamt von " . number_format($Kredit6Zins, 2, ',', '.') . " € und einem Gesamtbetrag von " . number_format($RadPreis + $Kredit6Zins, 2, ',', '.') . " €.</br></br>";

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum