GavickPro / News-Show-Pro-GK5

Advanced Joomla! content module.
28 stars 37 forks source link

Hikashop NSP shows price is 0,00 #280

Open yepyep opened 9 years ago

yepyep commented 9 years ago

Hello,

NSP shows prices 0,00 (this is the retail price, which i do not use).

I have changed modal.php this results in 1064 error. https://www.gavick.com/forums/storefront-joomla3/nsp5-and-data-source-39980?p=222068&hilit=hikashop%20nsp#p222068

Can you pleas help me to let NSP show the price and the original tripe trough price?

Thanks!

dziudek commented 9 years ago

Hello,

Did you tried to set the retail price in your products?

yepyep commented 9 years ago

Hello, yes sure i did and that works.

But i do no use this retail price I use the normal price (including and excluding tax). FE only shows prices including tax and some products discount price with stripe trough of the original price (all tax included).

yepyep commented 9 years ago

Hello dziudek, I managed to let NSP show the pirces without tax with code below. How can I show the price tax included (and second wish the original stripe trough price)?

$query_news2 = '
      SELECT DISTINCT
         content.product_id AS id,
         content.product_alias AS alias,
         price.price_value AS product_msrp,
         category.category_id AS cid,
         category.category_name AS cat_name,
         category.category_alias AS cat_alias
      FROM
         #__hikashop_product AS content
         LEFT JOIN
            #__hikashop_product_category AS category_xref
            ON
              category_xref.product_id = content.product_id
         LEFT JOIN
            #__hikashop_category AS category
            ON
              category_xref.category_id = category.category_id
         LEFT JOIN
            #__hikashop_price AS price
            ON
              price.price_product_id = content.product_id
        WHERE              
         ('.$sql_where2.')
         AND category.category_published = \'1\'
      ORDER BY
         content.product_id ASC
      ';
hikashop-nicolas commented 9 years ago

Hi,

Suppose that you have your product price in a variable $my_product_price and the id of the tax category of your product in $my_product_tax_category_id Here is how you can get the price with taxes: if(!include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_hikashop'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php')) return true; $class = hikashop_get('class.currency'); $my_product_taxed_price = $class->getTaxedPrice($my_product_price,hikashop_getZone(),$my_product_tax_category_id); echo $my_product_taxed_price;

So it should be fairly easy to display the taxed price once you have the untaxed price of a product.

yepyep commented 9 years ago

dziudek,

Can you make anything out of the comment of Nicolas? I'm definitely not able to make this work correct. should this be included in the NSP modal.php?

dziudek commented 9 years ago

Please check this patch: https://github.com/GavickPro/News-Show-Pro-GK5/commit/23553efb89545e481e353fdcee7ade3641ff9684 for me it is working fine.

yepyep commented 9 years ago

Thanks Dziudek, it works! The only thing which NSP does not show is the discounted price (sales price incl. tax and discount) and the original price (sales price incl. tax) striped through.

Do you know how to add this so sales price incl. tax = 999,- (and stripe throug) and the sales price incl tax incl discount is 799,-

I will ask Nicolas form HS, who alsways gives great support also!

hikashop-nicolas commented 9 years ago

In that case I would recommend instead to use the getListingPrices: $class = hikashop_get('class.currency'); $class->getListingPrices($product_objects,hikashop_getZone(),hikashop_getCurrency(),'cheapest'); This will add a prices array of prices in each object product of the $product_objects array and in the price objects, you'll get all the prices you need: the price without tax with discount, the price with tax with discount, the price without tax without discount and the price with tax without discount. That function is optimized to do as less queries as possibles for a list of products and that's what we use to load the prices of the products in product listings in HikaShop.

dziudek commented 9 years ago

@hikashop-nicolas - I'm using the following code:

static function store($config, $item) {
        $html = '<div class="nspHikashopBlock">';
        //
    if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) {
            return true;
        }

        $app = JFactory::getApplication();
        $currencyHelper = hikashop_get('class.currency');
        $taxed_price = $currencyHelper->getTaxedPrice($item['price'], hikashop_getZone(), $item['tax_id']);
        $mainCurr = $currencyHelper->mainCurrency();
        $currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
        $msrpCurrencied = $currencyHelper->convertUniquePrice($taxed_price, $mainCurr, $currCurrency);

        $tempProduct = new stdClass();
        $tempProduct->product_id = $item['id'];
        $tempProducts = array($tempProduct);
        $currencyHelper->getListingPrices($tempProducts, hikashop_getZone(), hikashop_getCurrency(), 'all');

But unfortunately - even if I set the getListingPrices price type param to "all" I get:

[prices] => Array
                (
                    [2] => stdClass Object
                        (
                            [price_id] => 1
                            [price_currency_id] => 1
                            [price_product_id] => 1
                            [price_value] => 89.00000
                            [price_min_quantity] => 2
                            [price_access] => all
                            [price_site_id] => 
                            [price_value_with_tax] => 89.00000
                            [taxes] => Array
                                (
                                )

                        )

                    [0] => stdClass Object
                        (
                            [price_id] => 95
                            [price_currency_id] => 1
                            [price_product_id] => 1
                            [price_value] => 29.00000
                            [price_min_quantity] => 0
                            [price_access] => all
                            [price_site_id] => 
                            [price_value_with_tax] => 29.00000
                            [taxes] => Array
                                (
                                )
                        )
                )
        )

There is no prices without tax and with tax - there is only output of the prices which I've put inside the product setting. Additionally in the HikaShop Starter I don't see any way to set a discount for my product.

hikashop-nicolas commented 9 years ago

You give the answer to your first question in your second question :) If you don't set any discount for a product, then there is no price without discount variable added. In the Starter edition, you can only set discounts global to all the products. You can do that via the menu Orders>Discounts. Once you create it, you should be able to see the price without discount variables added in there.

yepyep commented 9 years ago

Appreciate the work guys! Please take into consideration that I am using HS business edition ;)) (I don't know if this makes a difference)

yepyep commented 9 years ago

Hello Dziudek, I was wondering about the status. Can you tell me anything about te timetable? Thanks

speerwolf commented 9 years ago

Hello, I have the same Issue with the the taxed prices in the Gavick News Module. Is there any progress? Because when I load in the newest model.php and view.php it gives out an Error.

yepyep commented 8 years ago

Hello, I just updated to nsp gk5 1.9.2.1 and see that it pulls the price without discount and it does not show the strip-through price. Also the image (hikashop) is not showing now.

I would like to be able to show the

This is the minimum which needs to be clearly shown to a visitor.

Can you have another look at this? Thanks in advance!