Posts by Mxkert

    Hello,


    I have had this problem before, and could only reverse this with moving backwards to a very old backup.

    The problem is about the price of the products. When I give a product the price 59,99, so with a , and I add the product to cart, it adds with the price 59.00.


    When I give the product the price 59.99 with a . and I go to checkout, it won't proceed to checking out, and I get the following error in my debug:


    Code
    1. 0,0663 0,0002 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','manual','59.99','44','59.99','0.00',59,99,'0.00','0.00','0.00','0.00','0.00','0.00','0.00',59,99,'0.00',0,0,0,0,NULL,'0.00','2019-11-23 17:10:38','standard','{\"terms_agreed\":\"true\"}','56',NULL,0,'391','392')
    2. 0,0665 0,0003 Invalid query: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

    So for some reason, some bug happened, because a few days ago it did work and now when reverting to a working backup, I get the same errors. When trying to insert the order into the database, it does this with a , instead of a . as seen here:


    Code
    1. VALUES('created','manual','59.99','44','59.99','0.00',>>>>>>>>59,99<<<<<<<<<,'0.00','0.00','0.00','0.00','0.00','0.00','0.00',>>>>>>>>59,99<<<<<<<<<,'0.00',0,0,0,0,NULL,'0.00','2019-11-23 17:10:38','standard','{\"terms_agreed\":\"true\"}','56',NULL,0,'391','392')

    So now it is seen as too many fields getting inserted.


    EDIT: This happens with every gateway, even manual.

    You have to specify the id of the field you wish to sort by, for example:


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

    It worked. I now used the SKU to check if the product already exists, if not I import the product.


    Code
    1. foreach($result['data'] as $productData){
    2. $Products = new PerchShop_Products();
    3. $newProduct = $Products->get_one_by('sku', $productData['productcode']);
    4. if (!$productData['productcode'] == $newProduct) {
    5.                 #
    6.             }
    7.         }

    Hello,


    Is it possible to use the PerchShop_Products to find a product using the slug or any other field, instead of searching for the ID like this example:


    Code
    1. $Products = new PerchShop_Products();
    2. $newProduct = $Products->find($product['id']);

    Can we use the ->find for looking for the slug?

    With <?php perch_content('Rooms Main');?> you are creating a region, which now will show up in the Perch Dashboard. There you can select a template that you will be using to fill the region with.


    So for example in /perch/templates/content/ you can create a file named rooms_main.html. In this file you put the code:

    Code
    1. <perch:content id="body" type="textarea" label="Article body" html editor="redactor">


    Now when selecting a template for the region, this rooms_main.html template will show up and you can use this template to fill the region with.


    My suggestion:

    Instead of your code, I would only write <?php perch_content('Rooms');?> on your page.

    Then for the template (create it in /perch/templates/content/rooms.html) I would use:

    Code
    1. <h1><perch:content id="heading" type="text" label="Heading"></h1>
    2. <perch:content id="body" type="textarea" label="Body" html editor="redactor">

    So now you can write your page from one region instead of two.

    Sometimes, after moving a website, I have to remove the core folder and upload a fresh downloaded core folder to the server for the WYSIWYG to show up.


    EDIT: Make sure to make a back-up first!

    Answer to Q2:


    In the documentation you can find a way to sort blog posts by a field, and choose Descending (DESC), Ascending (ASC) or Random (RAND) sorting:

    https://docs.grabaperch.com/fu…/perch-blog-recent-posts/


    If you would like to alphabetically sort your blog posts by title, for example, you could use:


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

    First 10.000 char of debug:


    Here you go: