Posts by Mxkert


    I beautified the most important part:



    orderItemsTotal and orderSubtotal do have decimals in place, but are not strings.

    I think for some reason some of the values should be strings, for example: 109,04 should be '109,04'. I see two values like this, so then the total values would be 30.


    After some checking, I saw that orderItemsTotal and orderSubtotal are not written as strings in the values. How could I change this so they will be sent to the database as strings?

    Hello,


    I imported data into my database, from another webshop that I have. Since importing this data, when checking out I get the following message in the debug:


    Code
    1. 0,1035 0,0003 INSERT INTO perch3_shop_orders(orderStatus,orderGateway,orderTotal,currencyID,orderItemsSubtotal,orderItemsTax,orderItemsTotal,orderShippingSubtotal,orderShippingDiscounts,orderShippingTax,orderShippingTaxDiscounts,orderShippingTotal,orderDiscountsTotal,orderTaxDiscountsTotal,orderSubtotal,orderTaxTotal,orderItemsRefunded,orderTaxRefunded,orderShippingRefunded,orderTotalRefunded,orderTaxID,orderShippingWeight,orderCreated,orderPricing,orderDynamicFields,customerID,shippingID,orderShippingTaxRate,orderBillingAddress,orderShippingAddress) VALUES('created','mollie','118.85','44','109.04','9.81',118,85,'0.00','0.00','0.00','0.00','0.00','0.00','0.00',109,04,'9.81',0,0,0,0,NULL,'0.00','2019-10-13 11:54:23','standard','{\"terms_agreed\":\"true\"}','93','4',9,'659','660')
    2. 0,1037 0,0002 Invalid query: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1


    What does this mean?


    Mike

    I use ProductImporter to get products from an API. I would like to change the price of the products.


    Currently there is no way to update products by using the ProductImporter. So to keep my products updated, I want to delete all products and import all products again from the API on a regular basis, so if a product is deleted or added in the API, it also gets deleted or added on my website.


    If I would just edit the price of a product, I would lose this value when deleting and importing back.


    So my idea was to create collections and connect them to products, by giving them the same slug for example. Use this collection to overwrite fields from the product.


    I hope this is not too vague of an explanation.

    Hello,


    I am using Perch Shop and I have imported a lot of products. Now I would like to make a collection which I attach to a certain product, by using the same slug for the product and the collection item for example. I want to create a field in the collection which will be used as the price of the product, so this collection item field will overwrite the price of the product.


    What would be the best solution to achieve this?


    Mike




    EDIT:


    I tried overwriting the product price by setting the price variable, but no luck.


    Code
    1. $plantPrijs = perch_collection('Planten', [
    2. 'filter' => 'slug',
    3. 'match' => 'eq',
    4. 'value' => perch_get('s'),
    5. 'skip-template' => true,
    6. ]);
    7. $plantPrijs = $plantPrijs[0]['prijs'];
    8. PerchSystem::set_var('price', $plantPrijs);

    On the product page I am outputting the collection with the same slug. Retrieving the price field from the collection and trying to overwrite the original product price field with this value.

    This is the result from the API call (only the first few products):


    Code
    1. {"data":[{"timestamp":"2019-02-03T14:46:45+01:00","productcode":"FO1","potsize":"21","height":"100","dutchname":"Areca \/ Dypsis Palm","linnaeusname":"Areca","numberperorder":"1","purchaseprice":"18.26","promotionaltext":"Groot en groen, maar niet t\u00e9 ruig. Een stijvolle plant.","description":"Goudpalm uit Madagaskar. Daar een bedreigde soort, maar onder andere op de Cara\u00efben zijn ze verwilderd en veel voorkomend. In de volle zon verkleuren de bladeren en de plant heeft gele bloemetjes: vandaar Goudpalm.\r\n\r\nDe Areca is niet makkelijk, maar wel populair in interieurs. Onder gunstige omstandigheden groeit hij tot aan het plafond. In de natuur kan hij 10 meter hoog worden.","specifications":"goudpalm; areca; pot 21 cm; hoogte 100 cm; groene plant; lichte plek in huis","caretips":"Zet de plant op een lichte plek, maar niet in de volle zon. De Goudpalm heeft ook een hekel aan tocht, en je moet er niet tegenaan lopen. Vermijd tenslotte radiatoren.\r\n\r\nGeef de palm in de zomer 2 \u00e0 3 keer per week lauwwarm water, 's winters 1 keer per week. Af en toe sproeien vindt ze fijn.\r\nDe plant groeit traag, geef haar hooguit in de groeiperiode 1 keer per maand voeding.","aboutgrower":"Fondieplant is \u00e9\u00e9n van de grootste Areca-palm kwekerijen in Europa.","branches":"","images":["https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.jpg","https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.3.jpg","https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.2.jpg","https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.4.jpg","https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.5.jpg","https:\/\/www.floraathome.nl\/uploads\/products\/FO1\/FO1.6.jpg"],"grower":"Fondieplant","category":"Groene Plant"},
    2. ...

    Yes, ofcourse.


    Maybe not the cleanest code.

    I still get the same error, but I guess it could be due to the fact that I am working in the my_sample sample app, because I see this sample function in the apps runtime (which also uses the Template function):


    Maybe I should clean up the app first...

    And after deleting the AssetImport part of the code (so it is easier to just focus on the indexing of the products, without importing the assets), I get the following error:

    Code
    1. [Wed Sep 18 16:00:49.914965 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to a member function find_all_tags_and_repeaters() on null in /[ROOT]/[SITENAME]/perch/core/lib/PerchBase.class.php:185, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    2. [Wed Sep 18 16:00:49.915093 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: Stack trace:, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    3. [Wed Sep 18 16:00:49.915111 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: #0 /[ROOT]/[SITENAME]/perch/templates/pages/shop/importeren.php(76): PerchBase->index(), referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    4. [Wed Sep 18 16:00:49.915124 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: #1 /[ROOT]/[SITENAME]/perch/core/runway/start.php(43): include('/home/kndrxwbst...'), referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    5. [Wed Sep 18 16:00:49.915132 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: #2 /[ROOT]/[SITENAME]/perch/core/runway/start.php(47): perch_runway_dispatch_page(Object(PerchRoutedPage)), referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    6. [Wed Sep 18 16:00:49.915141 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: #3 {main}, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    7. [Wed Sep 18 16:00:49.915148 2019] [fcgid:warn] [pid 14238:tid 140618135090944] [client 31.160.4.226:57320] mod_fcgid: stderr: thrown in /[ROOT]/[SITENAME]/perch/core/lib/PerchBase.class.php on line 185, referer: http://[DOMAIN]/perch/addons/apps/my_sample/