JQuery | $(…).flexslider is not a function

$(…).flexslider is not a function, this issue mainly occurs after upgrading the jquery version or Multiple initialization of jquery. Try below points will help you to sort out the issue.

  • if your jquery version  is greater than jquery-1.8.3.js, call the script at bottom of page before closing </body> tag or if version equal or less than 1.8.3 place the script top of page.
  • Check whether you not initialize the jquery more than once.
Advertisements

CSS | Place Text Over Image using CSS

Below HTML code guide you to insert text (Hot Fried Prawns) over the image.

<!DOCTYPE html>
<html>
<head>
<title> CSS – Insert Text Over Image using CSS</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css&#x22; rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Miriam+Libre&#x22; rel="stylesheet">
<style type="text/css">
.banner-textimg-section {
text-align: right;
}
.banner-textimg-section > .banner-text {
padding-top: 10em;
padding-right: 5em;
position: absolute;
display: inline-block;
text-align: right;
width: 100%;
}
.banner-textimg-section > .banner-text{
transform: translateX(-100%);
-moz-transform: translateX(-100%);
-ms-transform: translateX(-40%);
-webkit-transform: translateX(-100%);
-o-transform: translateX(-100%);
}
.banner-img {
width: 100%;
}
.home-button-section.default-button-link {
font-family: 'Miriam Libre', sans-serif;
text-decoration: none;
color: #F44336;
background: #ffffff;
padding: 6px 20px 2px 20px;
text-transform: none;
font-weight: 600;
font-size: 2.5em;
display: inline-block;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="container">
<div class="banner-textimg-section">
<div class="banner-text pull-right">
<div class="home-button-section default-button-link">Hot Fried Prawns</div>
</div>
<img class="img-responsive banner-img" title="Banner Section" src="sampleimage.jpg" alt="Banner Section">
</div>
</div>
</body>
</html>

Magento Change Theme Using Controller

We can change the theme using magento controller by adding below code before $this->loadLayout(); , $this->renderLayout(); . Theme update reflects only on the specific controller.

public function indexAction()
{
/* Begin - Design Package */
Mage::getSingleton('core/design_package')
                    ->setPackageName($package) // $package = base, default, {{custom_package}}, ...
                    ->setTheme($theme); //  $theme = iphone, default, {{custom_theme}}, ...
/* End */
$this->loadLayout();
$this->renderLayout();
}

Magento Export Category List as CSV Format

Using the below code, you can export magneto category list as CSV format. Place the code in your root directory, and the exported file will be saved on  var/export directory.  So the CSV format includes

"Root Category Id", "Category Id", "Category Name", "Category URL", "Category Image", "Category Page Title", "Category Meta Keywords", "Category Mate Description","Category Is Active"
require_once 'app/Mage.php';
Mage::app();
$mageCategory = Mage::getModel ( 'catalog/category');
$categoryTree = $mageCategory->getTreeModel();
$categoryTree->load();
$categoryListIds = $categoryTree->getCollection()->getAllIds();
if ($categoryListIds) {
    $outputFileDir = "var/export/categories-detail.csv";
    $writeFile = fopen($outputFileDir, 'w');
    foreach ($categoryListIds as $categoryListId) {
        $categoryModel = $mageCategory->load($categoryListId);
        $parentCategoryId = $categoryModel->getParentId();
        $categoryId = $categoryModel->getId();
        $categoryName = $categoryModel->getName();
        $categoryUrl = $categoryModel->getUrl();
        $categoryImage = $categoryModel->getImage();
        $categoryPageTitle = $categoryModel->getMetaTitle();
        $categoryPageKeywords = $categoryModel->getMetaKeywords();
        $categoryPageDescription = $categoryModel->getMetaDescription();
        $categoryActive = $categoryModel->getIsActive();
        $collection = $mageCategory->getProductCollection();
        $data = array($parentCategoryId, $categoryId, $categoryName, $categoryUrl, $categoryImage, $categoryPageTitle, $categoryPageKeywords, $categoryPageDescription, $categoryActive);
        fputcsv($writeFile, $data);
        $i++;
    }
}
fclose($write);

Exact Difference Between Echo and Print in PHP

PHP Echo() and Print()

Print()

boolean print (argument)

print() is capable of displaying both strings and variables.
print() returns a Boolean Type, expresses a true value.

$language = "PHP";
$authour = "Rasmus Lerdorf";
$starts = 1994;

print $language;  // Resulting "PHP";

print $language.''.$authour;  
// Resulting "PHPRasmus Lerdorf"
// Multiple strings display using Concatenation(.) Operator. 
// print() has restricted of use comma(,) separator to display
multiple string, only echo() will do.

$year = print $starts;  // Resulting "1994" 

print $year; // Resulting Boolean Type "1"

Echo()

void echo (string argument1 [, ...string argumentN])

echo() is capable of displaying multiple strings and variables.
echo() doesn’t returns a Boolean Type, because it returns void.

$language = "PHP";
$authour = "Rasmus Lerdorf";
$starts = 1994;
echo $language; // Resulting "PHP"

echo $language,$authour; 
// Resulting "PHPRasmus Lerdorf"
// Displaying multiple string using comma(,) separator.

$year = echo $starts;  
// Syntax Error, Because print() has capable to result the output.

*echo() function is a faster, because it returns nothing, whereas print() returns a Boolean value.