Posts by Mxkert

    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/

    Ah ofcourse. I just edited that part but now it is giving me the following PHP errors:


    Code
    1. [Wed Sep 18 15:56:19.133775 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: PHP Warning: filesize(): stat failed for https://www.[DOMAIN].nl/uploads/products/FO1/FO1.jpg in /[ROOT]/[SITENAME]/perch/core/apps/assets/PerchAssets_Importer.class.php on line 47, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    2. [Wed Sep 18 15:56:19.133855 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] 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/
    3. [Wed Sep 18 15:56:19.133866 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: Stack trace:, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    4. [Wed Sep 18 15:56:19.133873 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: #0 /[ROOT]/[SITENAME]/perch/templates/pages/shop/importeren.php(76): PerchBase->index(), referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    5. [Wed Sep 18 15:56:19.133881 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: #1 /[ROOT]/[SITENAME]/perch/core/runway/start.php(43): include('/home/kndrxwbst...'), referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    6. [Wed Sep 18 15:56:19.133888 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] 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/
    7. [Wed Sep 18 15:56:19.133896 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: #3 {main}, referer: http://[DOMAIN]/perch/addons/apps/my_sample/
    8. [Wed Sep 18 15:56:19.133902 2019] [fcgid:warn] [pid 14238:tid 140618059556608] [client 31.160.4.226:56902] mod_fcgid: stderr: thrown in /[ROOT]/[SITENAME]/perch/core/lib/PerchBase.class.php on line 185, referer: http://[DOMAIN]/perch/addons/apps/my_sample/

    Hello Byron, thank you for the response. I tried it, but I get a PHP error:

    Code
    1. PHP Fatal error: Uncaught Error: Call to a member function index() on boolean in ......

    While using the following import code:

    Hello,


    I am using the product importer to import products, but they are not indexed after import. I have to save them manually to make them show up in the webshop.
    A piece of my code:


    Well a lot of assets do get imported correctly. I ran the importer 5 times, and all the images that are imported correct, show up 5 times (imported correctly) and the assets that are imported as blank/broken images, show up 5 times as broken images, so I think it has something to do with the size or something else related to the asset.


    I am using the following code to import the assets, coming from an API:


    One supported way of doing this is to write an app with an event listener to listen to the event Perch Shop fires when an order is complete. Hopefully the event returns all the data you need.


    Thank you for this, I think I can use this very well.


    Regarding the product SKU's, I found a solution by looking for the productID in the database and getting the SKU from that productID:

    SQL
    1. SELECT sku FROM perch3_shop_products WHERE productID = $productID

    Hello,


    When importing assets I am getting the following errors on some of the assets:

    Code
    1. [message] => filesize(): stat failed for https://www.[DOMAIN].nl/[IMAGE].jpg

    Does this mean that the file size is too big? Approx 50% of the images get uploaded just fine, but the rest are broken images displayed in the assets app.

    Byron, thank you for this example, it helped me a lot!


    Yes I had a repeater field for the product images, because not all products have the same amount of images. But I could make individual image fields in my template, like image1, image2 etc. to work around it.

    Well I am extending the PerchShop_Order.class.php to send the order through an external API. For that I am using the following code:



    Now I hardcoded the productcode (SKU) and the quantity and it is working fine. But now I have to get the productcode (SKU) and quantity for each product sold. Is there a way in which I could get those variables?

    Hello,


    Is it possible to import the images from a product with PerchShopProductImporter instead of the AssetImporter?

    The JSON data is as follows (with multiple images in the array per product):


    Code
    1. {
    2. "data": [
    3. {
    4. "images": [
    5. "http://www.domain.nl/uploads/product/image.jpg"
    6. ],
    7. }
    8. ]
    9. }

    Hello,


    I am importing a lot of assets, but after some time I get a maximum execution time error. The error:

    Code
    1. mod_fcgid: stderr: PHP Fatal error: Maximum execution time of 30 seconds exceeded in MYDOMAIN/perch/core/lib/PerchImage.class.php on line 644

    How can I increase this maximum execution time?


    Thanks,

    Mike

    Hello,


    I am trying to get the sku from a product, using the product id which I am getting from a shop order.

    Could anyone tell me how I can get the sku from the following product:


    Code
    1. $Products = new PerchShop_Products($this->api);
    2. $Product = $Products->find((int)1);

    You could use something like this:


    PHP
    1. <?php
    2. perch_blog_custom(array(
    3. 'count' => 1,
    4. 'template' => 'post_in_list.html',
    5. 'sort' => 'postDateTime',
    6. 'sort-order' => 'DESC',
    7. ));
    8. ?>