Magento 2 provides some default attributes that are added to the quote and order item data. Here is how to go about adding custom Attributes to Magento 2 quotes and orders.
If you’ve read Adding Custom Attributes to Quotes and Orders in Magento 1, then the below steps aren’t too dissimilar from adding custom attributes ...
This post covers the Array Functions section of the Arrays chapter when studying for the Zend PHP 7 Certification.
A list of some of the common functions used when dealing with arrays can be seen below.
array_push()
This function pushes one or more elements onto the end of array.
<?php
$stack = array("orange", "banana");
array_push($stack, ...
This post covers the Array Interation section of the Arrays chapter when studying for the Zend PHP 7 Certification.
There are several ways that we can iterate over arrays. For numeric arrays, a simple for loop might look like the below.
$numbers = array(0, 1, 2, 5, 10);
for ($i = 0; $i < ...
Magento provides some default attributes that are added to the quote and order item data. Here is how to go about adding custom Attributes to Magento quotes and orders.
Whenever you need to access a quote or order item’s SKU, or name, you can do so by using $item->getSku() and $item->getName().
This is because of ...
This post covers the Multidimensional Arrays section of the Arrays chapter when studying for the Zend PHP 7 Certification.
A multidimensional array is an array containing two or more arrays. The array could look like the below example.
<?php
$array = array(
"foo" => "bar",
42 ...
This post covers the Associative Arrays section of the Arrays chapter when studying for the Zend PHP 7 Certification.
Associative arrays are arrays that have named keys. So rather than having numeric keys, we can have keys that are composed as strings.
$array = array(0 => 'Jaguar', 1 => '5.4'); // Numeric
$array2 = array('make' ...
This post covers the Enumerated Arrays section of the Arrays chapter when studying for the Zend PHP 7 Certification.
An array in PHP is actually an ordered map, and the map is used as a way of ordering data by associating values to keys.
An array can be created using the array() language construct. It ...
In Magento, there exists a section within the Stores -> Configuration -> Customers -> Customer Configuration to control the minimum password length required when customers register an account on the Magento store. There is however no option to change the minimum password length for an admin user. To change admin user password validation in Magento ...
If you are a regular MAMP user then you are probably familiar with coming across issues that crop up with MySQL, particularly the classic #2006 - MySQL server has gone away that appears even when MAMP suggests the MySQL service is still running. Fixing MySQL gone away errors in MAMP 4 can be achieved by ...
We’re all familiar with using Magento’s getUrl() method when we want to retrieve a given URL in Magento, and additional checks may need to be added to check for secure pages.
As an example, on Magento’s cart page, there exists a newsletter form that can be viewed near the footer. If the cart page has ...