magento2 – Hoe to hide the uiComponent meant for a specific step on other step(s) on checkout page?

I’m relatively new to magento 2 and wanted to show totals uiComponent which is in sidebar displayArea at shipping step, now I’ve managed to do that but it keeps showing on billing step as well and I was wondering if there’s any way to hide it on all other steps except for where this uiComponent is meant for. Any help would be hugely appreciated. Here’s my checkout_index_index.xml

<referenceBlock name="checkout.root">
    <arguments>
        <argument name="jsLayout" xsi:type="array">
            <item name="components" xsi:type="array">
                <item name="checkout" xsi:type="array">
                    <item name="children" xsi:type="array">
                        <item name="steps" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="shipping-step" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shipping-totals" xsi:type="array">
                                            <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/totals</item>
                                            <item name="displayArea" xsi:type="string">totals_steps</item>
                                            <item name="config" xsi:type="array">
                                                <item name="template" xsi:type="string">Magento_Checkout/summary/totals</item>
                                            </item>
                                            <item name="children" xsi:type="array">
                                                <!-- sort order for this totals is configured on admin panel-->
                                                <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order -->
                                                <item name="subtotal" xsi:type="array">
                                                    <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item>
                                                    <item name="config" xsi:type="array">
                                                        <item name="title" xsi:type="string" translate="true">Cart Subtotal</item>
                                                    </item>
                                                </item>
                                                <item name="shipping" xsi:type="array">
                                                    <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/shipping</item>
                                                    <item name="config" xsi:type="array">
                                                        <item name="title" xsi:type="string" translate="true">Shipping</item>
                                                        <item name="notCalculatedMessage" xsi:type="string" translate="true">Not yet calculated</item>
                                                    </item>
                                                </item>
                                                <item name="grand-total" xsi:type="array">
                                                    <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item>
                                                    <item name="config" xsi:type="array">
                                                        <item name="title" xsi:type="string" translate="true">Order Total</item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>

code reuse – How to compose a potentially in-place editable page with React?

I have a public website with profile pages of people for the general public to see and a separate admin website with user login where people can edit their own profile page.

The profile page is editable on the admin website but should not be editable on the public website and want the admin website to have pretty much the same layout for the profile page but in editing mode.

Editing should happen in place in a WYSIWYG style, and the profile page has a fixed layout of its contents, including a profile picture, a person’s name, some contact info, a teaser text and a longer text section.

Text sections use Markdown with WYSIWYG editing.

The public website should not need to serve code for editing functionality, and I want to keep both websites consistent in terms of layout with minimal effort required to change the layout.

How can I ensure consistency of layouts with minimal effort while avoiding having to serve unnecessary code for editing functions on the public website?

My current approach would be to provide a skeleton component that accepts specific children satisfying particular interfaces and rendering them in the right places.

So I would fill that skeleton with editable components on the admin website and read-only components on the public website, but this still means a lot of duplication regarding the components used to fill into the skeleton.

wishlist – How to move Wish List next to Qty input box in product detail page?

To move the element next to the input box you have to create these files in your local theme:

app/design/frontend/Custom/default/Magento_Wishlist/layout/catalog_product_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="view.addto.wishlist" remove="true"/>
        <referenceBlock name="product.info.addtocart">
            <block class="MagentoWishlistBlockCatalogProductViewAddToWishlist" name="add-to-wishlist" template="Magento_Wishlist::catalog/product/view/addto/wishlist.phtml"/>
        </referenceBlock>
    </body>
</page>

app/design/frontend/Custom/default/Magento_Catalog/templates/product/view/addtocart.phtml

<?php
/** @var $block MagentoCatalogBlockProductView */
?>
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php if ($_product->isSaleable()) :?>
<div class="box-tocart">
    <div class="fieldset">
        <?php if ($block->shouldRenderQuantity()) :?>
        <div class="field qty">
            <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
            <div class="control">
                <input type="number"
                       name="qty"
                       id="qty"
                       min="0"
                       value="<?= $block->getProductDefaultQty() * 1 ?>"
                       title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                       class="input-text qty"
                       data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
                       />
                <span class="product-social-links">
                    <span clas="product-addto-links" data-role="add-to-links">
                        <?= $block->getBlockHtml('add-to-wishlist') ?>
                    </span>
                </span>

            </div>

        </div>

        <?php endif; ?>
        <div class="actions">
            <button type="submit"
                    title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
                    class="action primary tocart"
                    id="product-addtocart-button" disabled>
                <span><?= $block->escapeHtml($buttonTitle) ?></span>
            </button>
            <?= $block->getChildHtml('', true) ?>
        </div>
    </div>
</div>
<?php endif; ?>
<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {}
        }
    }
</script>

The wishlist block will then appear next to the input field in the dom. You will have to use css for the finishing touch:

enter image description here

reactjs – React / Recoil – changed recoil atom value doesn’t propagate until page refresh

I’m a Recoil / state management rookie and trying to understand atom value propagation. React frontend, Express backend, Postgres DB. There are no errors in React or Express — the image makes it to the bucket and the url makes it to the db. It’s just that the components are rerendering.

I have an atom like this:

export const userState = atom({
  key: 'userState',
  default: null,
});

Which in the put request is this:

const {
  id,
  email,
  first_name,
  last_name,
  display_name,
  avatar_url,
} = req.body;

If I then update a user property like avatar_url by 1) uploading the image to a gcloud bucket, then 2) updating the user table in my postgres db with the new url and finally 3) updating the atom with setUser({ avatar_url: newURL, ...user });. All good and fine except I have to refresh to see the new image.

Separate but related, my app has a post timeline and I found a bit of code which employs the Recoil selector to update only the changed post vs. the whole list. Clever and instant. Do selectors and atoms work hand and hand all the time, or are selectors only for computed mutations of the original atom you want to leave untouched?

Add to Cart button displaying twice on Shop Page Woocommerce

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

permalinks – WooCommerce return 404 in the product page

I am making an Ecommerce website with the plugin: OCEANWP.

I had an issue with links of products, because they aren’t the same so i changed it in Setting > Permalinks, but after when I go to the page and I click on a product I have 404: Page Not Found.
I already tried to fix it with htaccess file but it doesn’t work and I don’t know what to do..
I don’t want to lose all the work i’ve done!

8 – Twig get field value from panel page

I am trying to get the value of a field that is displayed in a panel page. I might be going about this all wrong, because I’m still getting used to Drupal 8. I want to display book information, including the ISBN value, which I use to make a link to Amazon.

I first tried a node template: node–book_page.html.twig and was able to do it by inserting the value of {{ content.field_isbn10.0 }} into the URL I added to the twig. This worked great, but when I tried doing the same thing to the template that I set up to be used by the panel page, nothing happens.

I know I have the custom layout twig working as it should, but I’m guessing that there is more to requesting the value than {{ content.field_isbn10.0 }} now that it’s going through node_view in Panels.

I have tried adding it to the panel page as entity_field:node:field_isbn10 as well as field_block:node:book_page:field_isbn10. I just can’t seem to get how to access the ISBN field value like I did in the node template.

Here’s what shows using kint:
enter image description here

Here’s the top of that knit:
enter image description here

wp query – 3 posts from each existing category on one page

The following is not working…

<?php $categories = get_categories( array(
'orderby' => 'name',
'parent'  => 0
) ); 
foreach($categories as $category):
    
    $args = array(
    'cat' => $category->name,
    'posts_per_page' => 3,);
    $category_posts = new WP_Query( $args );

    if( $category_posts->have_posts() ): ?>
            
        <h2><?php echo $category->name; ?></h2>
        
        <div class="row">
        <?php  while( $category_posts->have_posts() ):
            $category_posts->the_post(); ?>
        
            <div class="blog-post-tile" style="background-image: url(<?php 
                echo get_the_post_thumbnail_url(get_the_ID(), 'full');?>)">
                            
                <h3 class="blog-post-tile__title">
                    <?php the_title(); ?>
                </h3>
                                
            </div>
        <?php endwhile; ?>          
        </div>
    <?php endif;
    wp_reset_postdata();
    wp_reset_query();
endforeach;

My goal is to display on one page 3 latest posts from all existing categories. By now this code displays for each category same posts. It reads good category names just it seems like query is not reseted and it show posts again… To be honest it works at the beginning but it looks like I changed something in the code and broke it. I can’t find solution again.

I will do WordPress Yoast SEO On-page Optimization for $5

I will do WordPress Yoast SEO On-page Optimization

Yoast Plugin and All in one SEO plugin setting perfectly are very important for google ranking.

My Service Features:

  • Yoast Plugin Installation
  • Plugin setting Configure perfectly
  • Title Optimization
  • Description Optimization
  • Image Alt Tags Fixing
  • Content Optimization
  • H1 & H2 Heading
  • Robot.txt Optimization
  • XML Site Map Optimization
  • Webmaster Tools Setup

If you have any query for a sample of my previous work, please feel free to contact with me.

Note: I will not work on any illegal or adult site.

Regards,
Anisur Rahman

.

Page not found – Web Applications Stack Exchange

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange