What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Can someone please tell me where is the price data for abstract products saved in the database?

Posts: 217 🧑🏻‍🚀 - Cadet

Can someone please tell me where is the price data for abstract products saved in the database?

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Posts: 91 🧑🏻‍🚀 - Cadet

    @U048WDEP3R7 It should be in the same table where the concretes' are stored too: in spy_price_product_store

  • Posts: 91 🧑🏻‍🚀 - Cadet

    Unless you're looking for the storage tables, because those are separated by abstracts and concretes (spy_price_product_abstract_storage and spy_price_product_concrete_storage). But the base price data should be in the aforementioned one, together for both abstracts and concretes.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP I am on B2B store. Are they same on B2B as well?

  • Posts: 91 🧑🏻‍🚀 - Cadet
    edited January 2023

    @U048WDEP3R7 Should be, as I'm on a B2B store too and I see said tables in my store.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP Basically I am working on a custom product import. To add prices for abstract product, I am updating spy_price_product and spy_price_product_store . But I still can not see the prices in backoffice in the "Price & Tax" section when editing an Abstract product. Can you please tell me if there is something else I need to do?

  • Posts: 91 🧑🏻‍🚀 - Cadet

    @U048WDEP3R7 And do your abstract products really do have prices of their own in the import data source? Because as I know, abstract products don't necessarily need to have a price, only concretes. Maybe your abstract products don't have any price data to begin with?

    Also, I assume you checked that your import really did update the price data in the DB? If yes, then you might also try to debug the code when opening the "Price & Tax" tab in the backoffice (or the product detail page in the shop) and see what data it gets from where and how - and this way you'll be sure to find the source of the problem.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP Actually, I am manually added the abstract price data. Something like this:

    $this->setDataSetWriterPersistenceState(false);
    
            // todo try to initiate the following import sequences with chain of command pattern
    
            // adding/updating abstract product
            $spyAbstractProductId = $this->createOrUpdateProductAbstract($dataSet);
    
            // adding price
            // todo move it to a separate function
    
            $spyPriceProduct = new SpyPriceProduct();
            $spyPriceProduct->setFkPriceType(1);
            $spyPriceProduct->setFkProductAbstract($spyAbstractProductId);
            $spyPriceProduct->save();
    
            $spyPriceProductId = $spyPriceProduct->getIdPriceProduct();
    
            $spyPriceProductStore = new SpyPriceProductStore();
            $spyPriceProductStore->setFkCurrency(93);
            $spyPriceProductStore->setFkPriceProduct($spyPriceProductId);
            $spyPriceProductStore->setFkStore(1);
            $spyPriceProductStore->setGrossPrice(9002);
            $spyPriceProductStore->save();
    
            // adding/updating localized product abstract
    
            $this->createOrUpdateProductAbstractLocalizedAttributes($dataSet, $spyAbstractProductId);
    

    Just trying to figure out how can I show up the prices in the backoffice like this. So it seems like there is another schema that also needs to be updated.

  • Posts: 91 🧑🏻‍🚀 - Cadet

    @U048WDEP3R7 And did you check that these values were indeed added to your DB?

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP Yes I checked. They are being added.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP Here are the relevant screenshots

  • Posts: 91 🧑🏻‍🚀 - Cadet

    That's probably not the problem, but you really should add a net price data too.

  • Posts: 91 🧑🏻‍🚀 - Cadet

    Other than that, looks good to me so far. As I said above, you really should check with a debugger to see what is happening when the backoffice (or the store) tries to get the price for the product. Then you could see immediately what the problem is.

  • Posts: 91 🧑🏻‍🚀 - Cadet

    Sometimes it happens that errors get "swallowed" by try/catches deep in the code and you don't even notice them unless you step it through with the debugger.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP thanks. I will try to debug it now 🙂

  • Posts: 91 🧑🏻‍🚀 - Cadet

    yw 🙂

  • Posts: 91 🧑🏻‍🚀 - Cadet

    @U048WDEP3R7 I checked a bit further and I think you're missing a connection in the spy_price_product_default table

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP Unfortunately, I did that as well but still doesnt work

  • Posts: 91 🧑🏻‍🚀 - Cadet

    Hmm... do you also have the DEFAULT and the ORIGINAL entries in the spy_price_type table?

  • Posts: 91 🧑🏻‍🚀 - Cadet

    also, what you have in your spy_price_product_default table is wrong

  • Posts: 91 🧑🏻‍🚀 - Cadet

    because the fk you have there is not the same as the id in your price_product_store table

  • Posts: 91 🧑🏻‍🚀 - Cadet

    There, you have 7711, and here you have 959

  • Posts: 91 🧑🏻‍🚀 - Cadet

    @U048WDEP3R7 I think this latter mismatch will be your problem. Try updating that 959 fk value to 7711 in your spy_price_product_default table.

  • Posts: 217 🧑🏻‍🚀 - Cadet

    @U04FXCTCWPP WOW that was the issue. I missed it. Thank you very much for pointing that out.

  • Posts: 91 🧑🏻‍🚀 - Cadet

    yw 🙂

Welcome!

It looks like you're new here. Sign in or register to get started.