[TYPO3-commerce] Show scaled prices in basket & redirect to previous page after buying article
Christoph Nikic
cnikic at elmos.de
Wed Nov 7 15:44:49 CET 2007
Hi,
i had the exact same problem. This hook helped me:
-- SCHNIPP --
function additionalMarker($markerArray,&$plugin,&$article,&$product) {
$markerArray['###SCALED_PRICE_GROSS###'] =
tx_moneylib::format($plugin->basket->basket_items[$article->uid]->get_price_gross(),$plugin->currency);
$markerArray['###SCALED_PRICE_NET###'] =
tx_moneylib::format($plugin->basket->basket_items[$article->uid]->get_price_net(),$plugin->currency);
return $markerArray;
}
-- SCHNAPP --
-- SCHNIPP --
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['makeArticleView'][]
= 'tx_commercetools_basket_hooks';
-- SCHNAPP --
Best regards,
Christoph
Andre Dittmar schrieb:
> Good Morning,
>
>> In the basket, you should always see the correctly scaled price - if
>> not, something is wrong. It at least works in my installation, and I
>> also only use net prices (b2b-shop), but I tweaked quite a lot for a
>> better handling of only net prices.
>
> Sadly in my basket I always see the "default-price" (the first
> configured price in the article-definition). I use the marker
> ###BASKET_ITEM_PRICENET### which - as far as I can see - will be
> filled in the class.tx_commerce_pi2.php with the method
> makeArticleView().
>
> The price will be received by a get-Method of the
> class.tx_commerce_basket_item.php, getNoScalePriceNet().
> Unfortunately there are only methods to get the non-scaled price? If
> I use the method getPriceNet(), I get the same price.
>
> It seems that I have to use the additionalMarker-hook in
> class.tx_commerce_pi2.php to use a custom marker for that? At the
> moment I can't reproduce what can be wrong, it seems that the current
> version of commerce doesn't support the output of the scaled price
> (related to the current amount of an article) in the basket and
> somewhere else. Is this correct?
>
> If I have to use a hook, your code snippet might be useful for me as
> a footing, thanks for that.
>
>
>> I'm not aware of such a functionality, but you can use one of the
>> hooks
>> for that. But not 'postartAddUid', because not all basket handling is
>> finished on that point and the basket isn't stored yet. Maybe you can
>> use
>> '$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/
>> class.tx_commerce_pi2.php']['generateBasketMarker']'
>> for it - although it causes some overhead because of the marker
>> processing.
>
> Thanks for that hint, I have to try it out...
>
>
> Thanks again and best regards,
> Andre
>
> _______________________________________________
> TYPO3-project-commerce mailing list
> TYPO3-project-commerce at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-commerce
More information about the TYPO3-project-commerce
mailing list