Posts by Byron Fitzgerald

    The perch:before and perch:after tags are executed only once, Before the collections are displayed, and after the collections are displayed. As your perch:before tags are executed on the second iteration- as the first is seperated - perch won't recognise the tag. You'll need to move your perch:before tags into the first if block for them to be executed. However as the first if block is always the first item, the perch:before tags are redundant. To keep things consistent you can remove the perch:before and perch:after tags and stick with perch:if

    1. <perch:if exists="perch_item_first">
    2. <perch:content id="post_title">
    3.     <ul>
    4. <perch:else>
    5. <li><perch:content id="post_title"></li>
    6. </perch:if>
    7. <perch:if exists="perch_item_last">
    8.     </ul>
    9. </perch:if>

    Sort of grasping at straws now, but if you got to the PerchShop_Orders.class.php file and look for the create_from_cart function.

    If you could add the following

    1. PerchUtil::debug(PerchUtil::json_safe_encode($cart_data));
    2. $data = [
    3. 'orderStatus' => 'created',
    4. //... rest of data
    5. 'orderShippingAddress' => $ShippingAddress->id(),
    6. ];
    7. PerchUtil::debug(PerchUtil::json_safe_encode($data));

    This will hopefully output something into the debug that might hint to where things are going wrong

    From looking at the Perch Shop order code the two offending fields seem to be

    1. 'orderItemsTotal' => $cart_data['total_items'] + $cart_data['total_items_tax'],
    2. 'orderSubtotal' => $cart_data['total_items_with_shipping'] - $cart_data['total_discounts'],

    So it looks like it could be a type coercion error. Can you check your cart for the fields above?

    You'll have to loop through each block individually as well. Can't remember the exact syntax, but you can always do a var_dump() to get the exact structure of the array returned

    1. perch_content_custom('Videos', [
    2. 'each' => function($item) {
    3.                 foreach($item['_blocks] as &$block) {
    4.     if($block['youtube_video']['description']) {
    5.     $block['youtube_has_description'] = true;
    6.     }
    7.     }
    8.               }
    9. ])

    The <perch:if> tag doesn't work with the output attribute. Your best bet would be to use the each option in perch_content_custom and add a key if the description exists

    1. perch_content_custom('Videos', [
    2.     'each' => function($item) {
    3.                 if($item['youtube_video']['description']) {
    4.                     $item['youtube_has_description'] = true;
    5.                 }
    6.               }
    7. ])

    Then in the template you can use

    1. <perch:if exists="youtube_has_description">
    2. <perch:content id="youtube_video" type="youtube" output="description"/>
    3. <perch:else>
    4. Output something else
    5. </perch:if>

    You'll likely need to tweak the above so it works correctly, haven't used the youtube field type before.

    Whats the structure of the data your are passing to the importer? It might be that you are using the field ID for the asset ID, which I don't think works. You should have it set similar to the following (At least its worked for me in the past)

    1. $data[
    2.     ...collection_data
    3.     'image' => true,
    4.     'image_assetID' => $assetID
    5. ]

    You might be able to get some more information checking through the DB. Collections should be using revisions so you can check the collection_items table and you can check if the dynamicFieldsJSON is actually saving the assets or if they are been overwritten after the import.

    I think you have misunderstood what a TLD is. In the example above the TLD's you are using are .ca and .net. The local perch keys will not work with this. To use perch with a local key you will need to use one of the TLD's that Drew mentioned above. For example your sandboxes could use;



    As for your other three sites that will run in production, they will most likely need a license for each site. Perch lets you set a dev, staging and production environment for each license key