Developer forum

Forum » Development » When ISupportPriceInfo is Invoked?

When ISupportPriceInfo is Invoked?

Dmitrij Jazel
Reply

Hi everyone,

This is my ISupportPriceInfo Price provider implementation:

public class PriceProvider : Dynamicweb.eCommerce.Prices.PriceProvider, ISupportPriceInfo
{
    public PriceInfo FindPriceInfo(Product Product, double Quantity, string VariantID, International.Currency Currency, string UnitID, Dynamicweb.Frontend.Extranet User)
    {
        Helpers.ErrorMessage("FindPriceInfo id: " + Product.ID);
        return null;
    }
}

Question is: When exactly it is beying invoked.

Because For some reason, If I am trying to open Single Product page (PROD42 in this case), Feks: /Products.aspx?ProductID=PROD42

Than In the log message, I can see that method was invoked not only for PROD42, but for a bunch of other unrelated products.

Why?

Thanks in advance :)

 

P.S. Before we had ISupportPriceInfo (the old Price provider so to speak) We had the same issue, that it called a bunch of other Products, when that was neccesery. To be more specific when you are actually oppening a single product page.

 

/Dmitrij


Replies

 
Nicolai Høeg Pedersen
Reply

Becaus of related products, BOM, Variants or similar... We need to see your solution to give you a better answer...

 
Dmitrij Jazel
Reply

Hi Nocilai,

Is it enough to just to create a case, and send you guys a URL to solution?

Or would you require create a case, wrap whole application + DB, and send it to you?

 

The thing is that on this solution we are not using any BOM or Related products, Variants etc... Just plain default eCom products with some custom fields.

 

/Dmitrij

 
Nicolai Høeg Pedersen
Reply

I just need access to the backend (URL), the product with the problem, and maybe if you made your provider so it prints out the debug info on the screen so I can see what happens

 
Dmitrij Jazel
Reply

Hi Nicolai,

This sounds great, So basically I should write dirrectly to you, and include all the information about this, is that correct? :-)

We are generating a .txt file in the /Files/System/Log folder.

I will also can include a screencast about this.

 

Can I send email now?

/Dmitrij.

 

 

 
Dmitrij Jazel
Reply

Bump

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

In your product detail template (Optura2014_Product.cshtml), you have some UGLY code left behind... See dump.

NEVER leave behind a templatetags() call - it will query all the data and a bit more in a template.

BR Nicolai

 
Dmitrij Jazel
Reply

Hi Nicolai,

Thanks for that, I agree with your comment. Can't call it pretty, but as long as it does it's job. 

And thanks for pointing out that thing with templatetags(). To be honest not sure how that one got there, but I will make sure to check NOT to leave those behind!

But did you do anything else, or did that Removal of template tag actually did the trick?

 

Question #2) In the same log file that you seen, have you tryed adding product to cart?

Now when single product page makes only 1 call (as it should), When adding product to the cart - It is clear that Product invokes price provider several times (3-4 times) again.

Is that normal, or should I search for simmilar things like templatetags() left out somwhere again?

 

/Dmitrij

 

 
Nicolai Høeg Pedersen
Reply

Hi Dmitrij

I did not do anything. And now with the screen dump :-).

@2: Prices does get looked up more than once in the cart - a problem with how it calculates taxes, vat, discounts etc. Your provider should make sure it only does 'expensive' code once per request for each product ID. Using a Response.Item cache or something.

BR Nicolai

Capture.PNG
 
Dmitrij Jazel
Reply

Hi Nicolai,

@1 Thanks for pointing this one out... live and learn...

@2 I had exactly the same thoughts, Thanks allot for help so far! :-)

 

/Dmitrij

 

You must be logged in to post in the forum