Creating Interactive Product Pages With React and Cloudinary

Because today’s consumers expect a level of product customization they purchase online, e-commerce sites must support more personalization, a key to which is adding features to product pages, also called order pages. That’s where shoppers can customize the products they want to buy by changing product properties, such as size, color, delivery means, and quantity.

User-friendly UX demands that when shoppers make purchases, they receive visual feedback. For example, if someone is buying a shirt in red, the product page should account for that by updating the shirt’s image to a red variant. Given how difficult it is to change the color of non-SVG images, implementing such a feature can be daunting. Fortunately, Cloudinary, a cloud-based solution for managing and delivering rich media, including images and videos, makes it a breeze.

This post steps you through the process of leveraging Cloudinary to build a demo app with these three capabilities for product pages:

  • Varying image sizes: Cloudinary can seamlessly deliver product images in multiple sizes (main image; thumbnails; hi-resolution, zoomed-in images). All you need to do is add the sizes to the URL, after which Cloudinary dynamically generates the various images.
  • Varying colors: Some products come in multiple colors, the images for which are typically individual ones that all need to be uploaded and processed. With Cloudinary, you can change the color of a product by calculating how much to adjust the RGB channels of the original color to arrive at the desired color. This approach allows infinite scaling, enabling you to switch to any color in the spectrum.
  • Custom text: Many retailers offer features for personalization, such as embroidering, adding logos, and designing your own products. Cloudinary can overlay text and images on top of a shirt, for example, and can even make it look photorealistic with displacement mapping.

This is what the demo app looks like:

Here are the topics:

  • Setting Up the Environment
  • Solving Problem 1: Varying Image Sizes
  • Solving Problem 2: Varying Colors
  • Solving Problem 3: Custom Text
  • Trying It Out

Setting Up the Environment

Cloudinary integrates well with all front-end frameworks so feel feel to use the JavaScript core library or a specific framework-wrapper library. For the demo app in this article, set up the environment with React, as follows:

# 1. Install create-react-app globally.
npm install -g create-react-app
# 2. Create a new app.
create-react-app cloudinary-retail-page
# 3. Install the Cloudinary React library.
npm install --save cloudinary-react

For simplicity, all the sample code resides in the src/App.js folder.

Solving Problem 1: Varying Image Sizes

Above are two sets of images: main and thumbs (short for thumbnails). The main image is for shoppers; the thumbs, for interactions. Obviously, the selected thumb is the same as the main image, and you can deliver them in either of these two most common ways:

  • Manually create multiple images for a given product. However, this approach is not scalable given the large amount of products on most e-commerce sites.
  • Resize high-resolution images to fit the main or thumb section by means of CSS width and height properties. That’s the wrong thing to do because if an image has three variations and if each of them takes up 800 KB, you end up with the following: 1 main (800 KB) + (1 thumb (800 KB) x 3 models) = 3,200 KB (3.2 MB)

By specifying the size you prefer during delivery through image transformation with Cloudinary, you would have only one image on your Cloudinary server and can request a particular size for delivery. See this example code:

import React, { Component } from 'react';
import {Image, CloudinaryContext, Transformation} from 'cloudinary-react';

const ImageTransformations = ({width, selectedShirt}) => {
    return (
        <Image publicId={selectedShirt.main+'.jpg'}>
            <Transformation width={width} crop="scale" />
        </Image>
    );
};

class App extends Component {

    constructor(props) {
        super(props);
        const defaultShirt = {id: 1, main: 'shirt_only'};
        this.state = {
            shirts: [
                defaultShirt,
                {id: 2, main: 'laying-shirt'},
                {id: 3, main: 'hanging_t-shirt'}
            ],
            selectedShirt: defaultShirt,
        };
    }

    selectShirt(thumb) {
        this.setState({selectedShirt: thumb}, _ => this.forceUpdate())
    }

    render() {

        return (
          <div className="App">
              <CloudinaryContext cloudName="<YOUR_CLOUD_NAME>">
                  <div id="imageDemoContainer">
                      <div id="mainImage">
                          <ImageTransformations
                              width="600"
                              rgb={rgb}
                              selectedShirt={this.state.selectedShirt}
                              text={this.state.text} />
                      </div>
                      <div id="imageThumbs">
                          <ul id="thumbs">
                              {this.state.shirts.map(thumb => {
                                 return (
                                 <li className={thumb.main === this.state.selectedShirt.main ? 'active': ''} onClick={this.selectShirt.bind(this, thumb)} key={thumb.id}>
                                     {/*<Image publicId={thumb.main}>*/}
                                         {/*<Transformation width="75" crop="scale" />*/}
                                     {/*</Image>*/}
                                     <ImageTransformations
                                         width="75"
                                         rgb={rgb}
                                         selectedShirt={thumb}
                                         text={' '} />
                                 </li>
                                 )
                              })}
                          </ul>
                      </div>
                  </div>
              </CloudinaryContext>
          </div>
        );
    }
}

export default App;

Cloudinary’s React library exposes four components:

  • Image: Delivery of images, each with a public ID (publicId).
  • Video: Delivery of videos, each with a public ID (publicId).
  • Transformation: Transformations of images and videos.
  • CloudinaryContext: Wrapping of multiple instances of Image and Video under your cloud name, which Cloudinary assigns to you once you’ve signed up for free.

Here’s what transpires:

  1. The React state holds an array of image public IDs, `shirts`, that are on the Cloudinary server.
  2. You iterate over that array of shirts and request images of width 75 px. with the custom `ImageTransformations` component. Those images are then displayed as thumbs.
  3. On a click of a thumb, `ImageTransformations` renders the main image of width 600 px., which makes for an optimized solution, as shown here:

1 main (800 KB) + 1 thumb (100 KB ) x 3 models = 1,100 KB (1.1 MB)

3,200 KB  – 1,100 KB = 2,100 KB (2.1 MB)

That’s a saving of more than 60% of extra kilobytes, thanks to Cloudinary.

Solving Problem 2: Varying Colors

When shoppers choose a color for a product, what retailers usually do is create a clickable color palette and replace the images with the product image that sports the selected color. Such a practice does not scale, however, because a shopper might prefer a color that does not match any of the product colors on your page. Ideally, a given product would have countless colors, or shoppers would be able to customize the product’s color after purchase.

With Cloudinary, you can adjust the RGB channels of the original color with simple transformation—and with only one image as the source. See this code:

<Transformation effect="red:255" />
<Transformation effect="blue:255" />
<Transformation effect="green:255" />

You can then apply that code to the previous example, like this:

...
import { SketchPicker } from 'react-color';

const ImageTransformations = ({width, rgb, selectedShirt, text}) => {
    return (
        <Image publicId={selectedShirt.main+'.jpg'}>
            <Transformation width={width} crop="scale" />
            <Transformation effect={'red:'+((-1+rgb.r/255)*100).toFixed(0)} />
            <Transformation effect={'blue:'+((-1+rgb.b/255)*100).toFixed(0)} />
            <Transformation effect={'green:'+((-1+rgb.g/255)*100).toFixed(0)} />
            <Transformation underlay={selectedShirt.underlay}  flags="relative" width="1.0" />
            <Transformation overlay={selectedShirt.overlay}  flags="relative" width="1.0"  />
        </Image>
    );
};

class App extends Component {

    constructor(props) {
        super(props);
        const defaultShirt = {id: 1, main: 'shirt_only', underlay: 'model2', overlay: ''};
        this.state = {
            shirts: [
                defaultShirt,
                {id: 2, main: 'laying-shirt', underlay: '', overlay: ''},
                {id: 3, main: 'hanging_t-shirt', underlay: '', overlay: 'hanger'}
            ],
            text: ' ',
            selectedShirt: defaultShirt,
            background: {rgb:{r:255,g:255,b:255}}
        };
    }

    handleColorChange(color) {
        // Updates color
        this.setState({ background: color }, _ => this.forceUpdate());
    };

    selectShirt(thumb) {
        // Updates main image
        this.setState({selectedShirt: thumb}, _ => this.forceUpdate())
    }

    render() {
        const rgb = this.state.background.rgb;

        return (
          <div className="App">
              <CloudinaryContext cloudName="christekh">
                 <div id="demoContainer">
                      <div id="header">
                          <a href="http://cloudinary.com/">
                              <img width="172" height="38" src="http://res-1.cloudinary.com/cloudinary/image/asset/dpr_2.0/logo-e0df892053afd966cc0bfe047ba93ca4.png" alt="Cloudinary Logo" />
                          </a>
                          <h1>Product Personalization Demo</h1>
                      </div>
                  </div>
                  <div id="imageDemoContainer">
                      <div id="mainImage">
                          <ImageTransformations
                              width="600"
                              rgb={rgb}
                              selectedShirt={this.state.selectedShirt}
                              text={this.state.text} />
                      </div>
                      <div id="imageThumbs">
                          <ul id="thumbs">
                              {this.state.shirts.map(thumb => {
                                 return (
                                 <li className={thumb.main === this.state.selectedShirt.main ? 'active': ''} onClick={this.selectShirt.bind(this, thumb)} key={thumb.id}>
                                     {/*<Image publicId={thumb.main}>*/}
                                         {/*<Transformation width="75" crop="scale" />*/}
                                     {/*</Image>*/}
                                     <ImageTransformations
                                         width="75"
                                         rgb={rgb}
                                         selectedShirt={thumb}
                                         text={' '} />
                                 </li>
                                 )
                              })}
                          </ul>
                      </div>
                  </div>
                  <div id="demoInputContainer">
                      <div className="inputSelections">
                          <h2>Shirt Color:</h2>
                          <SketchPicker
                              color={ this.state.background.hex }
                              onChangeComplete={ this.handleColorChange.bind(this) }
                          />
                      </div>
                  </div>
              </CloudinaryContext>
          </div>
        );
    }
}

export default App;

You’ve now extended the app, as follows:

  • react-color library is a color library with many options. With the option SketchPicker, you select a color and set the background state with that color by means of handleColorChange.
  • You set the rg, and b values of the image with the Transformation component.
  • The RGB values are negative because Cloudinary’s redblue, and green parameters adjust the respective color channel by percentage, and the color white in RGB is the maximum value of 256,256,256. The only way to go is down from white, hence the negative adjustments.
  • To display the two images, one of the model wearing a shirt and the other of a hanger, you apply the underlay and overlay transformation, respectively.

Note: The code manually updates the view with component.forceUpdate() because component.setState() is asynchronous, which causes delays in reflecting the changes.

Solving Problem 3: Custom Text

You can add text to images with the Cloudinary overlay feature, which is a standard service offered by companies that print custom text on fabrics. The code can’t be simpler:

<Transformation overlay="text:Roboto_30Scotch.io" />

Next, add the text Scotch.io in 30-px. Roboto font. Alternatively, add a text field to collect the text and update the image with the text on receipt of a keystroke, as follows:

import React, { Component } from 'react';
import {Image, CloudinaryContext, Transformation} from 'cloudinary-react';
import { SketchPicker } from 'react-color';
import './App.css';

const ImageTransformations = ({width, rgb, selectedShirt, text}) => {
    return (
        <Image publicId={selectedShirt.main+'.jpg'}>
            <Transformation overlay={'text:Roboto_30:'+text} flags="relative" gravity="center" />
        </Image>
    );
};

class App extends Component {

    constructor(props) {
        super(props);
        this.state = {
            text: ' ',
          ...
        };
    }

   ...

    handleTextChange(event) {
        this.setState({text: event.target.value}, _ => this.forceUpdate())
    }

    render() {
        const rgb = this.state.background.rgb;

        return (
          <div className="App">
              <CloudinaryContext cloudName="christekh">
                  <div id="imageDemoContainer">
                  ..
                  </div>
                  <div id="demoInputContainer">
                      ...
                      <div className="inputSelections">
                          <h2>Text:</h2>
                          <input className="form-control" type="email" placeholder="Enter text" value={this.state.text} onChange={this.handleTextChange.bind(this)} />
                      </div>
                  </div>
              </CloudinaryContext>
          </div>
        );
    }
}

export default App;

We’ve truncated the above code sample so you can see the entire process.

Trying It Out

Using Cloudinary on your e-commerce site greatly eases the life of everyone on the creative team, opening up new opportunities that wouldn’t be available otherwise. Get started by signing up for free on the Cloudinary website.

The post Creating Interactive Product Pages With React and Cloudinary appeared first on Codrops.

How to Download specific folder(s) into Build server from Azure Repos Git

Hi All,

Basically, am using Azure Repos Git as for my source control with Azure Devops.
I am using automated build and deploy process.
Here, having one branch (for example master) within this branch having Multiple projects in different folder names (like, Project1, Project2, Project3, Project4...etc and one Common folder for supporting these all projects DLLs, Libaries)

When I try to create a build (pipeline) it will showing the option to download complete branch (master) from GIT to build server, due to this unwanted files and folders very quickly getting disk space issues. So trying to download specific folder(s) to build server and continue for a build - for example I would like to be downloaded Project1, Project2 and Common folders for Project1 build get succeed.

Can you please help?

Thanks,
AG

Transferring browser tabs

Hello.

I've got a couple of browsers installed and I have a question about that:

Is it possible to transfer a tab from the one browser to the other? Let's say: from AVG Secure Browser to Opera?

I don't really prefer the one browser above the other. Maybe I will grow something like that.

We need browsers.

Thanks, greetings, Leon

Hi everyone, I’m VoiceOverGenie

John Lano is a highly sought after full-time voice actor with a very contemporary, hip, laid back, cool, edgy, friendly, and conversational sound.
He has recorded hundreds of voice overs in his private studio for clients all over the world, including several of the most recognizable brands in the world, including AT&T, Samsung, UnderArmour, Porsche, and hundreds more.

How to Make a High Converting Sales Funnel in WordPress

Do you want to make a high converting sales funnel in WordPress?

A sales funnel is the path a user takes on your website to become a customer. Optimizing this path can lead to higher conversions and more sales.

In this article, we’ll show how to make a high converting sales funnel with practical examples. We’ll also explain how to track and optimize your existing sales funnels.

Creating effective sales funnel in WordPress for higher conversions

What is a Sales Funnel?

A sales funnel is the journey a person takes from the moment they find out about your business, all the way to becoming a loyal customer.

Marketers often talk about funnels in stages, from awareness of the problem they need to solve, all the way to taking action to make a purchase.

Sales funnel example

For online businesses, a sales funnel consists of the specific pages that a new users may visit on your site before they make a purchase.

That means that if you run an online business, an eCommerce store, or a business service, then you already have a sales funnel on your website.

Depending on how you set up your website, your sales funnel may have several steps that lead users to make a purchase. For example, a new visitor might land on a blog post, then view a product page, then go through your checkout flow.

You can optimize each of these steps to offer a better user experience, reduce distractions, and nudge users towards completing the purchase.

You can also track the performance of your sales funnel, run tests to see what works best, and then make data driven decisions to improve your sales funnel.

That being said, let’s take a look at how to easily create a high converting sales funnel in WordPress.

1. Creating a Sales Funnel Landing Page in WordPress

Usually the first step of every sales funnel is users arriving on your website, whether that’s via a product page, sales page, or other landing page.

WordPress allows you to easily create simple pages for your website. Your WordPress theme may also come with a customizable homepage.

However, these pages are not optimized for sales, and leave several holes in your sales funnel that allow potential customers to slip through.

This is where SeedProd comes in. It is the best WordPress page builder on the market and allows you to easily create landing pages, sales page, product pages, and more.

Sales page templates

SeedProd comes with dozens of ready-made templates that are already optimized for higher conversions.

Plus, it has an intuitive drag and drop interface that you can use to customize your pages.

SeedProd landing page builder

SeedProd also includes a WooCommerce integration that allows you to add eCommerce elements to any page.

For example, you can display featured products that you want to upsell, display product grids, add cart buttons, and more.

Custom WooCommerce cart page

You can also create a custom WooCommerce cart experience with product upsells to boost sales.

SeedProd integrates with your existing email marketing services, so you can easily capture leads and convert them to paying customers later on.

It works with any WordPress theme and allows you to create any design from scratch, without relying on your theme design. You can even use it to create stand alone landing pages for custom domain aliases and drive more traffic and sales to your website.

2. Boost Conversions for Your Sales Funnel

Creating a conversion oriented landing page for your sales funnel helps you get more sales. However, you will still notice many customers not following the funnel path and abandoning the user journey.

This is where you’ll need OptinMonster. It is the world’s best conversion optimization software on the market and allows you to easily convert website visitors into paying customers.

OptinMonster comes with marketing tools like lightbox popups, countdown timers, slide-in popups, sticky header and footer banners, full-screen popups, spin to win popups, and more.

OptinMonster campaign types

It comes with dozens of templates, and each of them is fully customizable using the OptinMonster campaign builder.

The drag and drop builder allows you to easily edit your campaigns without having to code.

OptinMonster campaign editor

OptinMonster comes with an incredibly powerful set of targeting rules. This allows you to personalize your marketing campaigns and show them only to targeted users at the right time in their user journey.

For instance, you can offer free shipping to users in particular regions, or show campaigns to users who already have specific products in their cart, and more.

OptinMonster display rules

OptinMonster integrates with all top email marketing platforms so you can capture leads who may not be interested in making a purchase right away.

You can also use it to redirect users to download lead magnets, receive exclusive coupons, or get personalized offers.

Time-based popups

3. Create Lead Generation Forms in WordPress

More than 70% of people visiting your website will leave without making a purchase or following the user journey along your sales funnel.

Lead generation forms allow you to capture users’ contact information such as an email address or phone number. You can then persuade those customers to make a purchase when they’re ready to.

WPForms is the best WordPress form builder plugin on the market. It allows you to easily create lead generation forms for your sales funnel.

It is super easy to use with ready-made form templates for all sorts of forms.

Form templates in WPForms

It comes with a drag and drop form builder.

Using the builder, you can just point and click to edit a form field or add new fields to your form.

WPForms form builder

Plus, WPForms integrates with your email marketing platform and more than 3000+ apps through Zapier. This makes it easier for your sales and marketing team to manage those leads and make more sales.

You can add your forms to any post or page, sidebar widget, and even inside popups using a block or shortcode.

Newsletter signup form in a WordPress post

You can also create standalone form pages, conversational forms, surveys and quizzes, and more.

Conversational Form Demo

4. Upsell Products in WooCommerce

One of the most important steps in a sales funnel is to show additional offers to users on their path to make the purchase.

However, once a user has added products to their cart this is what they would typically see:

Default cart experience in WooCommerce

CartFlows is a WordPress sales funnel builder and optimization plugin that allows you to change that.

You can use it to create complete sales funnels or optimize your existing sales funnel with additional steps.

It comes with a One-click Upsells feature, which allows users to add products to their cart on their way to the checkout.

One-click upsell offers in CartFlows

You can also optimize a users journey by adding one-click order bumps, pre-checkout offers, custom checkout form layouts, beautiful templates, and more.

Pre-checkout upgrade

Once a user has completed the purchase, this doesn’t mean it’s the end of their user journey. You can still redirect them to a custom thank you page with more special offers.

SeedProd comes with excellent templates that you can use for thank you pages. It also includes a WooCommerce product grid, shopping cart button, and many other elements to help customers continue shopping.

Adding upsell offers to thank you page

5. Track and Optimize Sales Funnel

After you have created and optimized your sales funnel in WordPress, next you would want to track its performance.

Most importantly, you need to know how users interact with your sales funnel and at what point they abandon your website before making a purchase.

MonsterInsights makes it super easy to monitor and track your sales funnel. It is the best Google Analytics plugin for WordPress and allows you to see where your users are coming from and what they do while visiting your site.

Upon installation, MonsterInsights allows you to track conversions across your WordPress website. See our guide on conversion tracking in WordPress for detailed instructions.

MonsterInsights also comes with an eCommerce addon. This helps you add Google’s Analytics enhanced eCommerce tracking and show you an easy to understand eCommerce tracking report.

Adding upsell offers to thank you page

You can also run A/B split tests with Google Optimize with MonsterInsights Google Optimize addon. This helps you compare sales funnel performance and see what’s working best for your business.

Google Optimize

We hope this article helped you learn how to create high converting sales funnels in WordPress. You may also want to see our expert pick of the best AI chatbot software to boost your sales even more, or check out our guide on how to choose the best web design software.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Make a High Converting Sales Funnel in WordPress appeared first on WPBeginner.

Excel not opening

Would you fix how to for me the issue that it keeps preventing attached excel from opening, it shows the dialogbox of connecting to d.docs.live.net to enter your window Live ID credentials.