Payment of ₹ requested by HONEY VIG. Click the link to pay securely via Razorpay: Make 5000 payment Payment of ₹ requested by HONEY VIG. Click the link to pay securely via Razorpay: Make 5000 payment ⭐ If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/honeyvig
Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, October 1, 2026

Beginners Guide to DHTML

 

Key Takeaways

  • DHTML, or Dynamic HTML, is not a separate programming language but an enhancement that allows HTML pages to be dynamic, utilizing HTML, JavaScript, and CSS.
  • The primary feature of DHTML is the ability to alter the appearance and content of a webpage dynamically without reloading the page, using built-in browser capabilities in fourth-generation browsers.
  • DHTML implementation varies significantly between browsers; for instance, Netscape Navigator 4 uses the `` tag while Internet Explorer 4 relies on style objects associated with standard HTML tags like `
    ` and ``.
  • For cross-browser compatibility, DHTML requires using different scripting techniques depending on the browser, highlighting the importance of browser detection techniques like object detection for efficient scripting.
  • Despite the emergence of newer technologies like AJAX and jQuery, DHTML remains relevant and is a fundamental skill in creating interactive and dynamic web content.

As a self-proclaimed webmaster, I try my best to keep up with the latest in web technology. My current endeavor is DHTML, or Dynamic HTML. After hearing a lot about this technology and how it will eventually revolutionize the internet, I thought I had to get off the couch and start learning about it, before I lose the right to call myself a “webmaster”. If you’re just as clueless as I am when it comes to DHTML, this tutorial is for you. Enjoy, and please feel free to email me if you have questions.

That’s a great question, one that I admit I had a lot of trouble finding a straight answer to. I remember seeing a posting on a JavaScript newsgroup that attempted to answer this question with the reply:

“DHTML is the combination of HTML and JavaScript”

I said to myself “Isn’t that just a webpage with JavaScript on it then?” I was confused, to say the least. After shuffling through hundreds of search results on search engines for that elusive answer to my question, I still could not find it. So I thought, what the heck, I’ll learn DHTML first, then figure out what it is! Now that I’m somewhat a DHTML programmer, I think I’m ready to present you with a decent one-line definition to the word DHTML:

“DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more dynamic”

You see, DHTML is NOT a scripting language (like JavaScript), but merely a browser feature- or enhancement- that gives your browser the ability to be dynamic. What you really want to learn is not DHTML itself, but rather, the syntax needed to use DHTML. Before anything else, you may want to quickly visit Dynamic Drive to see what this language is capable of.

Like I said, DHTML is a collection of features that together, enable your web page to be dynamic. I think its important now to define just what the creators of DHTML meant when they say “dynamic”. “Dynamic” is defined as the ability of the browser to alter a web page’s look and style after the document has loaded. I remember when I was learning JavaScript, I was taught that you could use the document.write() method of JavaScript to create webpages on the fly. For example:

<script> document.write(“This is text created on the fly!”) </script>

“Not bad”, I remember saying to myself. But what if I wanted to create content not only on the fly, but on demand? Naive I was then, I tried doing just that, by nesting the above code in a function, and calling it via a form button:

<input type=”button” onClick=”writeconent()” value=”text”>

Pressing the button was nothing short of a big disappointment. My entire web page was erased, and I was left with only the text the function produced.

That was back then. Now, with the introduction of DHTML, I can alter content on a web page on demand, whenever I bloody feel like it, without having the browser erase everything else. That’s what DHTML is all about. The ability of the browser to change look and style even after the document has loaded.

Now that I’ve got you all excited, I think it’s only fair that I put a damper on it. The technology of DHTML is currently at its development stage, with NS 4 and IE 4 differing quite greatly in their implementation of this great technology. Its currently not possible to write one DHTML code and expect it to function in both browsers properly. Furthermore, the two browsers are at different stages in their development of DHTML; from my own knowledge and what I’ve heard, DHTML in IE 4 is far more powerful and versatile than NS 4’s. I don’t want to help spread any propaganda, so I’ll leave it at that.

This could either be a good thing, or a bad one, depending on your view. DHTML in NS 4 is quite simple, and comes down to essentially one word- Layer. I was pretty astonished myself, but its true- NS 4 relies completely on a new tag, called the <layer> tag, to spin up its DHTML magic. This new tag is dynamic in that it can be positioned anywhere on a web page (without relation to other content), moved around, its content inside updated on demand, and more.

Basic syntax

The basic syntax of the <layer> tag can’t be simpler (as if any tag in HTML is complicated!):

<layer>Text inside layer</layer>

The <layer> tag is a content tag, which means you can add into it content (like <table>). Go ahead, try inserting the above code onto your page…you’ll notice that the text inside the layer floats above other text, and overlaps them. Imagine a layer as a sheet of paper that resides on top of the rest of the page, and does not take up space within the flow of the document.

Layer attributes

A layer by itself can’t be more boring, not to mention useless. Fortunately, there’s more to it. Layers support attributes that allow you to position it using the x,y coordinates-system, give it a background, clip it (make only certain area of the layer visible), hide it from view, and so on. I’ve listed the most important layer attributes below:

Layer attributes id The name of the layer, used to identify it in your script left The position of the layer in relationship to the x coordinates top The position of the layer in relationship to the y coordinates width The width of the layer, in px or % height The height of the layer, in px or % bgColor The background color of the layer background The background image of the layer src The external html document contained inside the layer

Mix and match different attributes any way you like.

Click here for a sample layer that uses some of the above attributes

Notice I didn’t specify the left and top attributes. When you don’t, the layer is positioned where you defined it.

Scripting layers

Here’s one of the most important thing to learn about layers- how to script them. After all, its the scripts that make layers come alive. To access a layer, you need to use the following syntax:

document.layername

Accessing the layer is just the first step. Once you’ve accessed a layer, you can then go on and manipulate one of the layer’s attributes to produce dynamic effects.

Click here for an example where a layer’s background color interchanges between red and blue.

All of the layers’ attributes are read/write, so be sure to experiment with each of them!

As I began taking on and learning IE 4’s implementation of DHTML, and realized that there’s a lot more to it than its NS counterpart. DHTML in IE does not rely on any one tag, but rather, new objects and properties that stem out of the usual HTML tags you’re used to working with, such as <div> and <table>. It’s a lot more powerful, but at the same time, and lot more complicated to grasp.

The style object of IE 4

HTML elements in IE 4 now all support a style object, which is essentially the “dynamic” object used to manipulate the look and “feel” of that element. Like the <layer> tag, elements can also be assigned an “id” attribute, which can then be used to identify it during scripting. For example:

<div id=”adiv”></div>

In your script, the syntax required to access the style object of “adiv” would look like this:

adiv.style

The style object contains many properties, and by manipulating these properties, you can alter the look of an element, dynamically. I’ll show some of these properties now:

Important properties of the style object

  1. backgroundColor The backgound color of the element
  2. backgroundImage The background image of the element
  3. color The color of the element
  4. position The position type of the element. Accepted values are “absolute” and relative”
  5. pixelWidth The width of the element
  6. pixelHeight The height of the element
  7. pixelLeft The position of the element in relation to the x coordinates
  8. pixelTop The position of the element in relation to the y coordinates

The properties above only represent a subset of the total supported properties, but are the most commonly used ones. The basic syntax to manipulating any style property is the same, which I’ll show in a minute. By accessing these properties, we can change the look and style of most HTML elements (as opposed to just the <layer> tag in Netscape)!

Click here for a simple demonstration

Notice how I changed the text’s color:

sometext.style.color=’red’

I first used the element’s id to gain access to it, then, through the style object and finally the style’s color property, I was able to easily change the color of the text on demand!

All style properties are read/write, and are accessed in a similar manner: element id->style object->property name.

Click here for another example that expands an image when the mouse is over it, and reverts it back to its original size when the mouse moves out.

Yes, I know its not exactly the most practical example in the world, but it does illustrate DHTML at work quite well. The image changes dimensions on demand, without the need to reload the document. That’s something JavaScript alone can never do.

If you’re not yet scared off by all the differences in syntax and functionality between DHTML in NS 4 and IE 4, you’re ready to learn how to make content on your page dynamic, or change on demand!

Dynamic content in NS 4

Changing content in NS 4 involves -you guessed it- the layer tag. All layers are treated by the NS browser as a separate entity from the rest of the page, with their own document object (which in turn contains other objects supported by document). This is very important to understand, since the fact that layers contains another document object is what makes it possible to create dynamic content in NS. I’ll first construct a basic layer, then show how to change the contents inside of it:

<layer id=”alayer” width=100% height=30></layer>

Ready to access the document object of the above layer? Here’s the required syntax:

document.alayer.document

So, knowing this piece of information, I can write a script that changes the contents of the layer every 3 seconds.

Click here for an example of how it’s done in Netscape.

The text is being dynamically generated and erased, without the need to reload the document!

Dynamic content in IE 4

In IE 4, dynamic content is realized through a special property called innerHTML that exists on the <span> and <div> tag. Just set this property to a new HTML value, and the contents inside that span or div is instantly updated to the new value! I’ll illustrate how it’s done by modifying the above example to create dynamic content for IE 4 users:

Click here for an example that works for IE.

Same results, just a different way to get there!

If you like working with animations, you’ll be glad to know that with DHTML, the entire web page is now your drawing board! You can create content that fly all over the screen freely. In Netscape, this is done by manipulating the left and top attributes of the <layer> tag. In IE 4, the same thing is accomplished by altering the pixelLeft and pixelTop properties of the style object.

Moving elements in NS 4

Recall in lesson 2 that layers support the left and top property, which controls its offset from the document’s upper left corner. Well, by using simple math and a couple of lines of script, we can dynamically update these properties so the layer moves! The following example changes the left property of a layer so it moves horizontally when a button is pressed.

Click here for the example.

See, all I did was continuously add to the left property of “space” to move it, and set the property back to its original value when I want the layer returned back to its initial location.

Moving elements in IE 4

By the way, the day when NS and IE agree upon one implementation of DHTML is the day I can stop writing two versions of everything (just letting out a little frustration). Moving an element in IE 4 involves basically first wrapping that element either inside a positioned span or div, then changing the span or div’s pixelLeft and pixelTop properties. It sounds complicated, but is actually very simple.

Click here for the example.

What I did first was set the outside <div> called “spaceship” to a position of relative, which is necessary to make the element movable (you could also set it to a value of “absolute”). Then, by manipulating the pixelWidth property of it’s style object, the element moves.

Before “true” cross-browser DHTML becomes available (in other words, when NS and IE comes to their senses), cross-browser DHTML basically means using various scripting techniques you picked during those JavaScript years to sniff out which browser the user is using, and execute the code intended for that browser. In this lesson, I’ll first illustrate a way of creating a “cross-browser” layer, then show you a scripting technique I recently learned that allows you to easily sniff out the browser type of the surfer.

Creating a “cross-browser” layer

Ok, so we’ve got NS that understands the <layer> tag, and IE that understands the <span> and <div>. If we wanted to create a simple DHTML effect such as a moving image, we would usually need to use two tags- A layer tag for NS 4, and either a div or span tag for IE 4. Not exactly pretty, uh? Well, I recently learned that there is actually a way to create a “cross-browser” layer that uses only one tag, although its a little buggy on the NS side. Apparently NS 4 treats an absolutely positioned div the same as a layer. So, without any further delay, here’s an example of a cross browser layer:

<div id=”crosslayer” style=”position:absolute”></div>

NS 4 treates the above div exactly the same as it would with a layer. Like any other layer, to access it , we would first go go through the document object, then the layer’s id:

document.crosslayer

In IE 4, we would simply use the div’s id:

crosslayer

I found that in NS, specifying a layer this way, while convenient in terms of cross-browser compatibility, has one major draw back. Such a layer doesn’t always behave the way a normal layer should, and can sometimes actually crash the browser. Just be prepared to expect the unexpected!

Browser sniffing- object detection

Up until recently, whenever I wished to determine the browser type of my surfers, I would use the navigator object, like most JavaScript programmers would. The below illustrates using this object to sniff out both NS 4 and IE 4:

var ns4= (navigator.appName==”Netscape”&&navigator.appVersion>=4) var ns4= (navigator.appName==”Microsoft Internet Explorer”&&navigator.appVersion>=4)

Personally, I hate using the navigator object- its so complicated to use (just look at the above mess!). Well, I have good news to bring to you. There is actually a lot quicker way to sniff out various browsers, and its called object detection.

The idea is based on the way JavaScript works. If the browser does NOT support a particular object, JavaScript returns null when you reference it. Knowing this fact, we can use an object reference in your if statement (in place of the navigator object) to determine the browser of the user.

Let’s do an example. We know that NS 3+ and IE 4+ support the document.images object. If we wanted to sniff out these browsers, we would do this:

if (document.images) alert(“You are using NS 3+ or IE 4+”)

Translating the above into English, it reads: “If the browser supports the images object (which only NS 3+ and IE 4+ do), alert a message.

Think of object detection as an indirect way of determining the browser type of the user. Instead of directly determining the name and version of the user’s browser (through the navigator object), object detection is a more generic, less hassling browser sniffing technique.

So, how can we use object detection to sniff out NS 4 and IE 4? Well, only NS 4 supports the document.layers object, and only IE 4 supports document.all. We can use this knowledge to easily determine whether the user is using NS 4, IE 4, or both:

if (document.layers) alert(“You are using NS 4+”)

if (document.all) alert(“You are using IE 4+”)

if (document.layers||document.all) alert(“You are using either NS 4 or IE 4+”)

Now you never have to return to the messy navigator object to do your browser sniffings!

DHTML resources

Obviously, this tutorial serves only as an introduction to DHTML. Here are a couple of great resources to continue your DHTML endeavor:

Frequently Asked Questions (FAQs) about Dynamic HTML (DHTML)

What is the difference between HTML and DHTML?

HTML, or HyperText Markup Language, is a standard markup language used to create web pages. It is static, meaning it doesn’t change once it’s loaded. On the other hand, DHTML, or Dynamic HTML, is not a separate language but an extension of HTML. It combines HTML, JavaScript, and CSS to create interactive and dynamic web content. This means that DHTML allows web pages to change and interact with the user without needing to reload the page.

How does DHTML enhance user interaction?

DHTML enhances user interaction by allowing web pages to react to user inputs without reloading the page. This is achieved through the use of JavaScript and CSS. For example, DHTML can be used to create drop-down menus, animations, and other interactive features. This makes the user experience more engaging and efficient.

Can I use DHTML with other programming languages?

Yes, DHTML can be used in conjunction with other programming languages. While DHTML itself is a combination of HTML, CSS, and JavaScript, it can also interact with languages like PHP and ASP.NET. This allows for more complex and dynamic web applications.

Is DHTML still relevant today?

While newer technologies like AJAX and jQuery have gained popularity, DHTML is still relevant and widely used. It’s a fundamental part of web development and understanding DHTML can provide a solid foundation for learning more advanced web technologies.

What are some common uses of DHTML?

DHTML is commonly used to create interactive web content. This includes things like drop-down menus, form validation, animations, and image rollovers. It can also be used to create single-page applications, where the entire site or application is loaded in a single HTML page.

How does DHTML improve website performance?

By allowing web pages to react to user inputs without reloading the page, DHTML can significantly improve website performance. This reduces server load and makes the user experience smoother and faster.

What are the components of DHTML?

DHTML is composed of four main components: HTML, CSS, JavaScript, and the Document Object Model (DOM). HTML provides the structure of the page, CSS controls the presentation, JavaScript enables interactivity, and the DOM allows for manipulation of page elements.

How does DHTML work with the Document Object Model (DOM)?

The Document Object Model (DOM) is a crucial part of DHTML. It provides a structured representation of the web page, which can be manipulated using JavaScript. This allows for dynamic changes to the page in response to user inputs.

Is DHTML difficult to learn?

The difficulty of learning DHTML can vary depending on your prior knowledge and experience with web development. If you’re already familiar with HTML, CSS, and JavaScript, learning DHTML will be a natural extension of these skills. However, if you’re new to web development, it may take some time to grasp the concepts.

Where can I learn more about DHTML?

There are many resources available online to learn about DHTML. Websites like GeeksforGeeks, JavaTPoint, and TutorialsPoint offer comprehensive guides and tutorials. Additionally, you can find numerous video tutorials on platforms like YouTube.

Make PayPal Pay Later visible before checkout

 

PayPal Checkout Integration



Help drive conversion.
With 400M+ active accounts¹ and global recognition, PayPal helps you reach more customers and boost sales.
46% higher checkout conversion with PayPal.²





Power AOV with Pay Later.
Offer Pay Later throughout the shopping journey. Customers pay over time. You get paid up front.
62% higher average order value with Pay Later.³




BNPL Checklist.




Reach younger Venmo shoppers
Connect with 95M active Venmo accounts⁴ to drive sales, with a payment method Gen Z and Millennials already use and trust.
73% overall Venmo conversion rate.⁵





Take charge.
With PayPal, you can process all major credit and debit cards at a competitive rate. By bringing payments under one roof you can simplify reporting and consolidate your settlements to better understand your business.





Accept Apple Pay® and Google Pay™.
Apple Pay and Google Pay are part of PayPal’s all-in-one solution so you won’t have to juggle multiple payment providers.





Make repeat purchasing easy.
PayPal enables you to securely save your customers’ payment methods, including PayPal, Venmo (US only), Apple Pay, and credit and debit cards, providing a quick and easy checkout experience.






Go global. Make it local.
With country-specific payment methods, you can reach international customers while making your business feel local. Build trust with local payment options that correspond to the shopper's location.





Reduce business costs with Package Tracking.
PayPal users can track their purchases to their doorsteps in real time with PayPal’s new Package Tracking, part of PayPal Checkout reimagined. Increasing users’ visibility may help businesses enhance efficiencies through integrated order management with consolidated receipts.
18.1% reduction in INR (Item Not Received) dispute claims after OpenCart merchants implemented Package Tracking as part of PayPal Checkout.⁷





Designed with your business in mind.





Simple setup.
See how to activate.


Upgrading is easy. And there’s no additional cost
For versions 4.0.0.0 and higher:
  • Go to ‘Payments’ section of Extensions
  • Find PayPal Commerce Platform Integration as recommended option
  • Install the module

For versions 3.0.3.8 and higher:
  • PayPal Commerce Platform is already available on the list of payment options and doesn’t need to be installed manually.

For versions < 3.0.3.8:
  • Download the latest PayPal Commerce Platform module from the OpenCart Marketplace.
  • Log in to the OpenCart admin panel. Select Extensions > Installer. Upload the zip file with the payment module under Upload your extensions.
  • Go to Extensions > Payments > PayPal Commerce Platform. Select the green button with the plus icon to Install.
  • Select Edit to set up payment methods.






Legal Disclosures:

Venmo is available only in the US.

Google Pay is a trademark of Google LLC.

Apple Pay is a trademark of Apple Inc., registered in the U.S. and other countries and regions. Apple Pay does not charge any additional fees.

*Pay Later is available in US, UK, DE, FR, IT, ES, AU. Product availability subject to local requirements. Merchant and consumer eligibility varies depending on status. Credit checks, fees and other requirements apply and vary depending on product and jurisdiction. See product-specific terms for details.

¹PayPal Earnings-Q4, 2024, based on PayPal internal data. Active accounts are PayPal consumer and merchant accounts that have completed a transaction within the past 12 months.

²Nielsen Behavioral Panel of USA with 29K SMB monthly average desktop purchase transactions, from 13K consumers between April 2022-March 2023. Nielsen Attitudinal Survey of USA (June 2023) with 2,001 recent purchasers (past 4 weeks) from SMB merchants, including 1,000 PayPal transactions & 1,001 non-PayPal transactions.

³Globally, the PayPal Pay Later average order value (AOV) is 62% higher than the standard PayPal AOV for small businesses. Internal Data Analysis of Small Business merchants with Pay Later transactions from January – December 2024. Data inclusive of Pay Later transactions across 7 markets (US, UK, AU, DE, ES, IT, FR).

⁴Based on PayPal Internal Data - 2024.

⁵Based on PayPal internal data of overall conversion rate results for Pay with Venmo from August 2023 - July 2024. Individual results may vary.

⁶There are 90 million Venmo active accounts in the United States. PayPal Internal Data – 2022.

⁷ Based on PayPal internal data, comparison period is from Nov 2023 to Jan 2024 and Nov 2024 to Jan 2025. OpenCart INR Disputes (Claims Only).

¹²Availability may vary depending on merchant’s integration method and geographic location.

¹³Additional terms for IC++ apply, see PayPal Online Card Payment Services Agreement for your market.

¹⁴Available on eligible transactions only. Limits, terms and eligibility criteria apply.

¹⁵Available on eligible purchases.

¹⁶Terms, exclusions and fees apply to the Chargeback Protection tool. Chargeback Protection is available for accounts enrolled in Advanced Credit and Debit Card Payments. See terms.

Thursday, November 6, 2025

How to enable “notify me when back in stock” for Magento 2

 

If a customer has ever abandoned your online store because the product they want isn’t available or if you’ve ever been forced to sell outdated products for a small percentage of what they originally cost, its a sign of poor stock management!

Magento 2 store owners are always looking out for tools that help them reduce cart abandonment due to stock unavailability. One such tactic is to let customers subscribe to the out of stock products and get notifications when back in stock!

How about implementing this trick without any 3rd party extension? 

It’s possible now with a default configuration to enable “notify me when back in stock” for Magento 2 stores. The feature is available in Magento 2 OpenSource and Commerce Edtion.

Admin can enable this feature for registered customers. There are two types of notification: price change alert and in-stock alert. Admin is allowed to select the email template for each notification Email and set the alert Email sender.

Steps to enable “Notify me when back in stock” for Magento 2:

1. Enable Out of stock products display in frontend

  • Navigate to Stores > Configuration > Catalog.
  • In Product Alerts, set Allow Alert When Product Comes Back in Stock to YES
1_Stock-Options

2. Enable notification when the product is back in stock

  • Navigate to Stores > Configuration > Catalog.
  • In Product Alerts, set Allow Alert When Product Comes Back in Stock to YES
3_Products-Alerts-Run-Settings

3. Set the frequency to send alert Emails

  • Navigate to Stores > Configuration > Catalog .
  • In Product Alerts Run Settings, select the Frequency from the drop-down menu and set the Start Time to send the notification Emails.
3_Products-Alerts-Run-Settings

However, there are certain limitations with this default Magento 2 features. What if these limitations get overcame?! It would be helpful to admin in understanding the market demand and hence manage the inventory accordingly.

Meetanshi has developed Magento 2 Out of Stock Notification extension that offers additional features that overcome the shortcomings of the default feature and helps to provide better User Experience by efficiently managing product inventory based on customers’ preferences! The additional features provided by Out Of Stock Notification for Magento 2 listed below:

  • All the visitors, guests and customers are allowed to subscribe for out of stock notifications of the out stocked products.
  • Set a custom button label for the out of stock subscription on the product page.
  • Set up and show catchy text to encourage users to subscribe for out stock alerts.
  • Admin can track the list of subscribers for each product from the backend.
  • Admin can allow subscriptions for out of stock alerts based on the customer groups.
  • Customers can easily edit, update and delete subscriptions from their “My Account” section.
  • Store owners can export the list of subscribers for Out of Stock Products.

Out of stock products can be a real headache for store owners as they neither want to remove such products from the store nor miss out the potential future sales. By enabling out of stock alerts for the users, one can not only save the sale but also get the perfect opportunity to engage with the customers and build your subscriber base. You can also leverage the best practices of out of stock email notifications to get the most out of this functionality.

You can also refer to the video tutorial to enable “notify me when back in stock” for Magento 2 from our Magento 2 video tutorial series:

Don’t let your potential future sales leave just because your out of stock products, enable Out of Stock Notification for Magento 2 and take the benefit of more engagement and users’ demand.

Happy Inventory Management ?

UPS Shipping Method Unavailable in Magento 1 or Magento 2 [Solved]

 

  • y 22, 2025
  • •
  • 2 min read
  • •
  • Posted in : Magento

United Parcel Service (UPS) offers domestic and international shipping services by land and air to more than 220 countries.

Owing to CGI Rating API, the Magento 1.x and Magento 2.x merchants have witnessed changes and an error like “United Parcel Service – This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.“

This is due to the change that took place on January 06, 2019 that UPS will now onwards only support the secure connections and not the HTTP connections.

The default Magento tends to connect using an HTTP connection. And that’s why the error due to no official support from UPS.

The solution is to switch to UPS XML API. However, there is a quick fix that does not require switching to XML. Let’s see how:

Solution: UPS Shipping Method Unavailable in Magento 1 or Magento 2

How to fix it in Magento 1.x:

  1. Login to Admin Panel and navigate to System > Configuration.
  2. Under Sales, click Shipping Methods.
  3. Expand the UPS tab.
  4. In the Gateway URL option, change the URL from http://www.ups.com/using/services/rave/qcostcgi.cgi to https://www.ups.com/using/services/rave/qcostcgi.cgi
UPS Magento 1 Issue Solution

Follow the video solution to fix UPS Shipping Method Unavailable issue in Magento1:

How to fix it in Magento 2.x:

  1. Login to Admin Panel and navigate to Stores > Configuration.
  2. Under Sales, click Shipping Methods.
  3. Expand the UPS tab.
  4. In the Gateway URL option, change the URL from http://www.ups.com/using/services/rave/qcostcgi.cgi to https://www.ups.com/using/services/rave/qcostcgi.cgi
UPS Magento 2 Issue Solution

Follow the video solution to fix UPS Shipping Method Unavailable issue in Magento 2:

That’s it.

In default Magento 1.x or Magento 2.x,  the UPS gateway URL uses the “http” protocol, but now one must use the “https” protocol to avoid any error.

However, the store owners using the UPS XML Rating API are not impacted by this change.

Thank You

Wednesday, November 5, 2025

How to Solve Magento 2 Service Temporarily Unavailable (503)

 

The error 503 in Magento 2 means that the server is not available at the instant. It may happen because the server is under the maintenance mode or is simply busy.

The Magento 2 store owners may face the Magento 2 Service Temporarily Unavailable error during the installation of a store or server:

“Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”

The store won’t be available at all when there is an error 503 in Magento 2.

Why Magento 2 Service Temporarily Unavailable Error Occurs

During the Magento 2 installation, the maintenance.flag file shows the system message until the operation is finished performing. It hides the screen from the users in case of any errors or issues while the process is going on. Technically, this system message should be removed once the operation gets completed. But sometimes, maintenance.flag file is not deleted automatically after the operation completion and thus, shows the Service Temporary Unavailable error in Magento 2 even after the process is completed.

How to Fix the Magento 2 Service Temporarily Unavailable Error

In order to fix the “503 service temporarily unavailable” error in Magento 2, follow these steps:

php bin/magento cache:flush
php bin/magento setup:upgrade

Note: In Magento 1.x version, the maintenance.flag file is present directly in the root directory.

That’s so easy, right?

Get rid of 503 error and solve the Magento 2 Service Temporarily Unavailable issue easily!

In case you still need any help to fix the 503 error in Magento 2, feel free to comment. I’d be happy to help.

Thank You!

How to Programmatically Attach PDF File in Magento 2 Email

 

Email Attachments are an easy way to send files without any barriers of geographical locations, security breaches, or cost. PDF files are usually preferred as they are uneditable, password-protected, small-sized, and easily accessible.

For Magento 2 stores, generally, Emails are sent for various purposes such as invoice, billing, coupon codes, etc. that require to attach PDF files. Manually attaching files for these tasks is not feasible. Instead, programmatically attach a PDF file in Magento 2 Email!

Magento 2 uses the lib/internal/Magento/Framework/Mail/Template/TransportBuilder class to send Emails, which doesn’t support file attachments yet.​​​​​​​ However, as the TransportBuilder Class uses Message class inherited from the Zend_Mail, we can add Email attachments programmatically.

Here’s the solution for the same.

Please note that the below solution is compatible till Magento 2.3.5 version only. If your store is running on versions above Magento 2.3.5, you may opt for Magento 2 Email Attachments extension that allows attaching important order documents, terms, and conditions, policy documents, spreadsheets, offer images, pamphlets, etc. in sales emails.

Method to Programmatically Attach PDF File in Magento 2 Email:

1. Create your TransportBuilder class, Vendor/Extension/Model/Mail/TransportBuilder.php

<?php namespace Vendor\Extension\Model\Mail; class TransportBuilder extends \Magento\Framework\Mail\Template\TransportBuilder { public function addAttachment($pdfString) { $this->message->createAttachment( $pdfString, 'application/pdf', \Zend_Mime::DISPOSITION_ATTACHMENT, \Zend_Mime::ENCODING_BASE64, 'attatched.pdf' ); return $this; } }

 2. Here I have created sample Email Sending Helper, Vendor/Extension/Helper/Data.php

<?php namespace Vendor\Extension\Helper; use Magento\Customer\Model\Session; class Data extends \Magento\Framework\App\Helper\AbstractHelper { const XML_PATH_EMAIL_DEMO = 'emaildemo/email/email_demo_template'; protected $_inlineTranslation; protected $_transportBuilder; protected $_template; protected $_storeManager; public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Vendor\Extension\Model\Mail\TransportBuilder $transportBuilder, \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_objectManager = $objectManager; parent::__construct($context); $this->_inlineTranslation = $inlineTranslation; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; } public function generateTemplate() { $pdfFile = 'pdf_file_path/email.pdf'; $emailTemplateVariables['message'] = 'This is a test message by meetanshi.'; //load your email tempate $this->_template = $this->scopeConfig->getValue( self::XML_PATH_EMAIL_DEMO, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_storeManager->getStore()->getStoreId() ); $this->_inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier($this->_template) ->setTemplateOptions( [ 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->_storeManager->getStore()->getId(), ] ) ->setTemplateVars($emailTemplateVariables) ->setFrom([ 'name' => 'Meetanshi', 'email' => 'meetanshi@meetanshi.com', ]) ->addTo('yourname@gmail.com', 'Your Name') ->addAttachment(file_get_contents($pdfFile)); //Attachment goes here. try { $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); $this->_inlineTranslation->resume(); } catch (\Exception $e) { echo $e->getMessage(); die; } }

Implement the above code to programmatically attach a PDF file in Magento 2 Email and save yourself from the tedious repetitive tasks!

Happy Emailing

How to Install a Theme in Magento 2

 

A theme in Magento 2 provides a consistent look and feel in the store frontend or the admin area, with the help of custom templates, layouts, styles or images. Nowadays, people tend to judge a book by its cover and thus, a beautiful design and theme play an important role in site recognition. The Magento 2 themes are well known to provide better customer experience and interactive platform! Hence they are a must-have in your store infrastructure.

Before diving into the method to install a theme in Magento 2, take a look at the advantages of themes and how to choose the perfect one for your E-commerce business! A banner is displayed in the frontend is not designed keeping in mind any custom theme designs. The solution to this issue is to override extension file in theme in Magento 2.

Advantages of a theme in Magento 2:

  • The responsiveness characteristic makes it possible to offer the same environment to every user, regardless of the operative platform.
  • The responsive themes provide a scalable platform, i.e., adding new features and functions to already built theme is easier.
  • Improved security features with the Magento 2 themes.
  • The responsiveness nature is appreciated by Google and other search engines, giving you the SEO benefit!
  • Improved user experience, of course!
  • Easy installation process (We’ll see here how easy it is to install a theme in Magento 2!)
  • The free Magento themes are compatible with the new versions of Magento and are optimized for all important web browsers.
  • Absolute uniqueness for your Magento 2 store with custom themes.

Points to keep in mind while choosing the Magento 2 Theme:

  • A well-built store with elegant visual effect can work wonders. While an ugly theme can increase the bounce rate. Hence, focussing on the appearance, select a professional looking theme that represents your business.
  • A robust theme with advantages of SASS, Bootstrap 3, HTML5, and CSS3 makes your store responsive.
  • User friendliness themes with easy navigations, useful buttons, and neat arrangements are essential for your theme.
  • It MUST be fast-loading and SEO friendly, for e.g. Hyvä Magento.
  • Select the theme suitable for your business model.
  • Select a theme that is compatible with multiple browsers to reach more audiences.
  • A good color blend with your products and services!
  • With the advanced use of social media, a social media friendly theme is appreciated.

Proceeding to the steps to install a theme in Magento 2, check the below method:

Methods to Install a Theme in Magento 2:

1. Install Manually

When you have a list of files in a zipped folder as a new theme, follow this method.

1. Unzip the theme

Unzip the archive of the theme and spot the two directories: app and pub.

2. Upload the files


  • Navigate to the root directory of your Magento 2 store
  • Upload the folders into the root directory.

3. Run the commands

  • Connect the store via SSH.
  • Navigate to the root directory
  • Upgrade the setup with these commands:
php bin/magento setup:upgrade  php bin/magento setup:static-content:deploy

The success of an E-commerce store is achieved by many things and a theme is one of the prominent element. Hopefully, the above tutorial has helped you enough to install a theme in Magento 2!

Thank You.

4. Login to Admin panel

  • Navigate to Content > Design > Configuration
  • Select Edit the store theme.
1_Design-Configuration
  • Select the desired theme from the dropdown menu and your Save Configuration.
2_Applied-Theme

2. Install via Composer

When you have a theme as a composer package, follow this method.

1. Purchase a theme from Magento Marketplace.

2. Achieve the Composer name of the theme;

3. Navigate to the root directory and enter the below command:


composer require <vendor>/<name>:<version>;

4. Wait till dependencies are updated;

5. Run the below commands:

git add -A && git commit -m "Add theme" git push origin <branch name>

To verify that the theme is registered, follow the below steps:

1. Login to Admin Panel and reload any of the backend pages after the theme is installed.

2. Navigate to Content>Design>Themes

3. Check if the theme is displayed on the right panel in the list of available themes.

The success of an E-commerce store is achieved by many things and a theme is one of the prominent element. Hopefully, the above tutorial has helped you enough to install a theme in Magento 2!

Thank You

Magento 2 Payment Restrictions – Extension Explained

 Magento 2 Payment Restrictions enables creating flexible rules to restrict payment methods. 

A proper payments function offers an enormous opportunity to acquire new customers, increase conversion rate, and ultimately grow revenue.

Starting a Magento 2 store, the main concern must be payment management. The method of accepting online payments must meet the customers’ need and effectively manage the cash flow of your business.

Keeping the above points in mind, Meetanshi has developed the Magento 2 Payment Restrictions extension. It restricts payment methods based on product attributes, cart attributes, shipping address, store views, and customer groups.

The store can offer privileged features to higher customer groups such as COD payment, and disable them for guest users. Moreover, if you want to disable the COD payment method for a distant shipping address, the extension helps to do so!

Improve the payment system of your Magento 2 store by creating flexible payment rules with the help of the Magento 2 Limit Payment Method module.
Configure Magento 2 Payment Restrictions Extension by Meetanshi

Creating rules to restrict the payment methods have never been this easy!

Navigate to Sales > Payment Restrictions. The grid offers the details of payment rules such as rule name, the restricted payment methods, customer group, store view and the status of the rule, i.e., if the rule is active or not in the store. One can edit a rule, create a duplicate one or create a new rule with the “Add Rule” button.

On click of the button, admin is redirected to the configuration of the rule. Enter the name of the new rule. Select the payment methods to be restricted based on the set conditions. Also, select the customer groups and store views to restrict payment method for. Lastly, activate the rule.

Moving on to the conditions, set them based on cart attributes or product attributes. When these conditions are met, the payment method is restricted for the set customer group or store views. Finally, save the settings.

Here, admin can set limitations on payments based on shipping parameters such as address, city, region, zip codes, etc.

When a customer proceeds to check out and if the configured conditions are not satisfied, the restricted payment method is not displayed on the frontend.

How to Override Block, Model, and Controller in Magento 2

 

Magento 2 CMS offers flexible options to customize the default configurations. The customized features are helpful to offer enhanced customer experience, easy administration, improved SERPs and sales!

However, it is advisable to override block, model, and controller in Magento 2 than editing the core files. This guide walks you through the method to overriding block, model, controller, giving you the flexibility to make changes in the core functionalities.

The Magento 2 Controller is responsible for handling the incoming requests. Blocks are PHP classes used to connect or create a link between layout and templates. The Model represents the data of the application in MVC.

Method to Override Block, Model, and Controller in Magento 2:

  • Magento 2 override Model class using di.xml

Use the following code to override Magento\ConfigurableProduct\Model\ConfigurableAttributeData Create file [Vendor]\[Module]\etc\di.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <preference for="Magento\ConfigurableProduct\Model\ConfigurableAttributeData" type="[Vendor]\[Module]\Model\Rewrite\ConfigurableAttributeData" /> </config>

Create class [Vendor]\[Module]\Model\Rewrite\ConfigurableAttributeData to override Magento Model

<?php namespace [Vendor]\[Module]\Model\Rewrite; use Magento\Catalog\Api\ProductRepositoryInterface; use Magento\Framework\Pricing\Helper\Data; class ConfigurableAttributeData extends \Magento\ConfigurableProduct\Model\ConfigurableAttributeData { private $productRepository; private $priceHelper; public function __construct( ProductRepositoryInterface $productRepository, Data $priceHelper ) { $this->productRepository = $productRepository; $this->priceHelper = $priceHelper; } protected function getAttributeOptionsData($attribute, $config) { $attributeOptionsData = []; foreach ($attribute->getOptions() as $attributeOption) { $optionId = $attributeOption['value_index']; $product_details = $config[$attribute->getAttributeId()][$optionId]; $productId = $product_details[0]; $product = $this->productRepository->getById($productId); $attributeOptionsData[] = [ 'id' => $optionId, 'label' => $attributeOption['label'], 'products' => isset($config[$attribute->getAttributeId()][$optionId]) ? $config[$attribute->getAttributeId()][$optionId] : [], 'sku' => $product->getSku(), 'childProductPrice' => $this->priceHelper->currency($product->getFinalPrice(), true, false), ]; } return $attributeOptionsData; } }
  • Magento 2 override block class using di.xmlCreate file : [Vendor]\[Module]\etc\di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <preference for="Magento\Swatches\Block\Product\Renderer\Configurable" type="[Vendor]\[Module]\Block\Rewrite\Product\Renderer\Configurable" /> </config>

Create class [Vendor]\[Module]\Block\Rewrite\Product\Renderer\Configurable to override Magento block

<?php namespace [Vendor]\[Module]\Block\Rewrite\Product\Renderer; class Configurable extends \Magento\Swatches\Block\Product\Renderer\Configurable { protected function getRendererTemplate() { return $this->isProductHasSwatchAttribute() ? self::SWATCH_RENDERER_TEMPLATE : '[Vendor]_[Module]::product/view/type/options/configurable.phtml'; } }

Magento 2 override controller class using di.xml Create file : [Vendor]\[Module]\etc\di.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <preference for="Magento\Catalog\Controller\Product\Gallery" type="[Vendor]\[Module]\Controller\Product\Gallery" /> </config>

Create class [Vendor]\[Module]\Controller\Product\Gallery to override Magento block

<?php namespace [Vendor]\[Module]\Controller\Product; class Gallery extends \Magento\Catalog\Controller\Product\Gallery { public function execute() { $result = null; if (!$this->_initProduct()) { $store = $this->getRequest()->getQuery('store'); if (isset($store) && !$this->getResponse()->isRedirect()) { $result = $this->resultRedirectFactory->create(); $result->setPath(''); } elseif (!$this->getResponse()->isRedirect()) { // Apply custom code } } return $result ?: $this->resultPageFactory->create(); } }

That’s all to override block, model, and controller in Magento 2!

Seems pretty much tedious, isn’t?

We’ve got your back. Contact us to do your customization tasks! Flawlessly implement amazing features helpful in your store administration tasks and also enrich customer experience!

Happy Customization