texts: How to apply cache tags to template file?

texts:
I am trying to implement a cache key to automatically change when URL is changed from secure (https://) to unsecure (http://) or vice versa

but I am missing something out that is causing the CACHE_KEY to not work.

Here is what I have tried so far:

Block class

Here I define the cache_key and cache_tag and check if store isCurrentlySecure

const CACHE_TAG = 'top_switcher';
const CACHE_KEY = 'currency_switcher';

protected function _construct()
{
    $this->_secure = Mage::app()->getStore()->isCurrentlySecure();
    $this->addData(
        array (
            'cache_tags' => array(self::CACHE_TAG),
            'cache_key' => array(self::CACHE_KEY),
        )
    );
    parent::_construct();

}

Next my cache_key info

public function getCacheKeyInfo()
{
    return array(
        'switch_container_content',
        (int)Mage::app()->getStore()->isCurrentlySecure(),
        Mage::getUrl('locale/switch', array('_secure' => true)),
        $this->_secure,
    );
}

Here I would like to switch to secure https:

public function getSwitchUrl()
{

    $currentUrl = (int)Mage::app()->getStore()->isCurrentlySecure() ?
            Mage::getUrl('module/switch', array('_secure' => true)) : Mage::getUrl('locale/switch');

    return $currentUrl;

}

In my form which is used to post data over secure and unsecure pages I add the <form method="post" action="<?php echo $this->getSwitchUrl(); ?>">

Can anyone tell me what I have done incorrectly?


texts: Incorrect product count in layered navigation after overriding list product collection

texts:
I have customized(override) product list collection getProductCollection and filtered collection as required.

public function getProductCollection()
    {
        if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) {
            $collection = $this->_productCollections[$this->getCurrentCategory()->getId()];
        } else {
            $collection = $this->collectionProvider->getCollection($this->getCurrentCategory());
            $this->prepareProductCollection($collection);
            $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection;
        }

        /* custom filter conditions */
        $productUniqueIds = array(10,11,12,13);
        $collection->addAttributeToFilter('entity_id',array('in' => $productUniqueIds));
        /* custom filter conditions end here */

        return $collection;
    }

Based on above products conditions, My result for listing page will be fine but layered navigation result is not proper, displays wrong filter attributes.

I am facing an issue in the layered navigation product count after applying filters on product collection. All counts are wrong. What I guess is I need to apply custom filters on layered navigation's collection as well, but I am not able to find it so far.

I have debugged and reached till _createItem function in vendor/magento/module-catalog/Model/Layer/Filter/AbstractFilter.php file. Product counts are coming from there, but I couldn't find from where exactly product collection gets returned.

Please share your ideas if you have. Any help would be appreciated.
Thanks


texts: Magento2: How to remove catalogue menu(Main menu) from frontend

texts:
How to remove catalogue menu from frontend. I will try to xml way its working fine

<referenceContainer name="header-wrapper">
        <referenceBlock name="navigation.sections" remove="true" />
</referenceContainer>

But i need programmatically in php file

Thanks


texts: Magento 2.3.4 Advanced JS Bundling: Should a `deps` node entry within a `shim` node be copied into `deps` module in the build.js file?

texts:
My store's requirejs-config.js has an entry for shim node as seen in the code snippet below, that includes an entry for deps node as well. I wonder if I should copy this deps node entry to the corresponding deps node although it is originally a part of shim node.

(function() {
var config = {
    shim: {
        'Swissup_Pagespeed/js/lib/loadCSS': {
            exports: 'loadCSS'
        },
        'Swissup_Pagespeed/js/lib/cssrelpreload': {
            deps: [
                'Swissup_Pagespeed/js/lib/loadCSS'
            ]
        }
    },
    deps: [
        'jquery/jquery.cookie'
    ]
};

require.config(config);
})();


texts: How to restrict ship to specific countries for several products

texts:
There are several products in my store that can only be shipped to the United States, UK, France, Germany, Canada. In addition to these products, other products can be shipped to all countries in the world.

How can I set restrictions on these products to allow only United States, UK, French, German and Canadian consumers to place orders?

thanks


texts: Setting the Indexer Scedule when using “Update by schedule"

texts:
I understand that using Update by schedule refers to the cron schedule for timing, when changing the Mode under Index Management. But I require some clarification.

M1

In M1, you would set the schedule under:

System > Configuration > Advanced > Index Management.

M2

In M2, I figure the below setting is comparable under:

Stores > Configuration > Advanced > System > Cron (Scheduled Tasks).

Objective

My objective is to have all Indexers that use Update by schedule, to run once per day at midnight.

Question

From what I can tell from the default value of "1", the Indexer runs every minute.

If I wanted the Indexer to run everyday at midnight, would I set Generate Schedules Every to "0", "1440" or something else? And would the other values in the section need changing?


texts: How to reposition this button on Order Summary.


texts: How to Override or Extend protected or parent function in Magento 2 using Plugin

texts:
I need to override protected function or parent function ex

 Magento\Checkout\Controller\Cart\Add is extended from Magento\Checkout\Controller\Cart
and getBackUrl() is a Magento\Checkout\Controller\Cart function, in this case how to do it
 as per this post Overwriting the Magento\Checkout\Controller\Cart\Add::getBackUrl with Plugin

I tried to implement using virtualType but not working
in di.xml

<virtualType name="myUrlBulder" type="Magento\Framework\Url">
     <arguments>
        <argument name="cust-add-url" xsi:type="object">Magento\Checkout\Controller\Cart\Add</argument>
    </arguments>
</virtualType>
<type name="myUrlBulder">
    <plugin name="custom-url" type="Sugarcode\Test\Model\Plugin\Product" sortOrder="1"/>
</type>

in Model/Plugin/Product.php

protected function afterGetBackUrl(\Magento\Checkout\Controller\Cart\Add $subject, $result)
{
    print_r($result); exit;
    return $this->_url->getUrl('some/custom/url');
}

I use plugin for other function that working fine,
I can also achieve it by  preference but I need it implement using  plugin
can any one help on this

and also i tried below  way also , this plugin for same to change url but at the time of update cart

<virtualType name="myCustomUrl" type="Magento\Framework\Url" />
    <type name="Magento\Checkout\Controller\Cart\UpdatePost">
        <arguments>
            <argument name="url" xsi:type="object">myCustomUrl</argument>
        </arguments>
    </type>
    <type name="myCustomUrl">
        <plugin name="my-custom-url-plugin" type="Sugarcode\Test\Model\Plugin\Cart" sortOrder="10"/>
    </type>

and in cart.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Sugarcode\Test\Model\Plugin;

class Cart
{

    public function aroundGetUrl(\Magento\Framework\Url $subject, \Closure $proceed)
    {
        echo 'aroundGetUrl
';
        $returnValue = $proceed(); // it get you old function return value
        //$name='#'.$returnValue->getName().'#';
        //$returnValue->setName($name);
        echo 'aroundGetUrl
';
        exit;
        return $returnValue;// if its object make sure it return same object which you addition data
    }
}

can any one suggest me how to do it


texts:
I have a custom module developed and it stores data by the store id that is selected in the admin form. All the data is stored in a separate table while store data is stored in a separate table. now I want to display that stored data by store id.
Can someone explain me how to do this?


texts: Method of payment without Magento Connect

texts:
I hope you can help me.
I have a group of shops where I'd like install the payment method Western Union, but I cannot use Magento Connect.
That way I could get the package files Western Union without using this tool.

Thanks.


texts: How to link directly to custom customer tab in admin

texts:
I've created a custom tab that displays some information in the Customer Admin section. I'm just curious if there's a way to link directly to this tab so it's opened on page load.
I don't want it the default active tab, but just a way to link directly to it and it would be active on page load.
Here's how I created the tab:
MyCompany/MyModule/view/adminhtml/layout/customer_index_edit.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">
  <head>
    <css src="MyCompany_MyModule::css/styles.css"/>
  </head>
  <body>
    <referenceBlock name="customer_form">
      <block class="MyCompany\MyModule\Block\Admin\Customer\Tab\CustomTab" name="customer_custom_tab" cacheable="false">
        <arguments>
          <argument name="tab_label" xsi:type="string" translate="true">Custom Tab</argument>
          <argument name="sort_order" xsi:type="number">50</argument>
        </arguments>
      </block>
    </referenceBlock>
  </body>
</page>

MyCompany/MyModule/Block/Admin/Customer/Tab/CustomTab.php
<?php

namespace MyCompany\MyModule\Block\Admin\Customer\Tab;

class CustomTab extends \Magento\Backend\Block\Template implements \Magento\Ui\Component\Layout\Tabs\TabInterface
{
  protected $_template = 'customer/customtab.phtml';

  public function __construct(
    \Magento\Backend\Block\Template\Context $context,
    \Magento\Framework\Registry $registry,
    array $data = []
  ) {
    $this->_coreRegistry = $registry;
    parent::__construct($context, $data);
  }

  public function getCustomerId()
  {
    return $this->_coreRegistry->registry(\Magento\Customer\Controller\RegistryConstants::CURRENT_CUSTOMER_ID);
  }

  public function getTabLabel()
  {
    return __('Custom Tab');
  }

  public function getTabTitle()
  {
    return __('Custom Tab');
  }

  public function canShowTab()
  {
    if ($this->getCustomerId()) {
      return true;
    }
    return false;
  }

  public function isHidden()
  {
    if ($this->getCustomerId()) {
      return false;
    }
    return true;
  }

  public function getTabClass()
  {
    return '_active';
  }

  public function getTabUrl()
  {
    return '';
  }

  public function isAjaxLoaded()
  {
    return false;
  }

}

This correctly displays my custom customer tab with content from customtab.phtml file. Just not sure how to set this tab as active via direct url.


texts:
i am using the porto theme and images are loading slow even when they are small in size and the server is very fast. it happens in the product page.. what's the cause of this? is that related to the theme?
examples:
https://www.deals4u.co.il/acer-predator-helios-300-gaming-laptop.html
https://www.deals4u.co.il/panasonic-lumix-g7.html

thanks


texts: Is it possible to use post method in catalog advanced search form?

texts:
The idea is to keep the form in catalogsearch/advanced/

and to post the result to catalogsearch/advanced/result/

without all parameters added by the get method.

What are the necessary changes to have toolbar working ?

Thanks


texts: Saving a product programmatically errors on duplicate

texts:
I've created a command which saves a number of products using

// \Magento\Catalog\Api\Data\ProductInterface
$product->save()

or

// \Magento\Catalog\Api\ProductRepositoryInterface
$productRespository->save($product)

Is there a way of telling the magento 2 api to only save if the product doesn't exist? I have almost 500,000 products which I don't want to re-import each time.

Just checking this is the correct way to do it too - because its SUPER slow.


texts: My magento site home page not indexed with google search

texts:
I have launched a new Magento site. A simple CMS page is config as default home page. I have added the meta keywords and descriptions in that CMS page.

But the home page not indexed in Google search. I can't find the exact issues.
I hope someone can guide me with a solution it would be appreciated.


texts: unable to update Status of product from csv

texts:
When I change the status field of product from enable to disable or vice versa via updating through csv using data flow profile, it is not updating value of status, simply leaves status of a product blank.
While manually I am able to update products as well as products status is inserted properly of new products.


texts: Magento 2 - Exception : Invalid method Magento\Customer\Block\Form\Register::escapeHtmlAttr

texts:
I am getting error when I click on "crate an account" link. Does anyone have a solution for this ?

The Error is ...

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid method Magento\Customer\Block\Form\Register::escapeHtmlAttr

Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid method Magento\Customer\Block\Form\Register::escapeHtmlAttr
**#0 /var/www/html/project/app/design/frontend/Etheme/buyshop/Magento_Customer/templates/form/register.phtml(27): Magento\Framework\DataObject->__call('escapeHtmlAttr', Array)
#1 /var/www/html/project/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/html/h...')
#2 /var/www/html/project/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Customer\Block\Form\Register), '/var/www/html/h...', Array)
#3 /var/www/html/project/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/var/www/html/h...')
#4 /var/www/html/project/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Framework\View\Element\Template->_toHtml()
#5 /var/www/html/project/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Element\AbstractBlock->toHtml()
#6 /var/www/html/project/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('customer_form_r...')
#7 /var/www/html/project/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('customer_form_r...')
#8 /var/www/html/project/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('customer_form_r...')
#9 /var/www/html/project/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('customer_form_r...', true)
#10 /var/www/html/project/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('customer_form_r...')


texts: Sending newsletters via cron job queue, blocks sending important emails to the customers, is there a way to make independent cron job queue which will be run only if core queue is empty or something like that? Thanks!


texts: How can we set the product-ID instead of the product-name in database on Magento2

texts:
In the download page, on the customer side (the page where customers can download the files for downloadable products), I am trying to add the product image next to every download item. However, I am having a problem in getting the product ID associated with each download.

In the database, I looked and found the table called "downloadable_link_purchased" in which the product-name is being saved but not the product-id.

I do not really need the product_name, so can I somehow set the product_ID of each item in the same column? There is not even need to make a new column or rename the product_name column, I just require to fill the product_name column with the product_id instead. I hope I have been clear enough, if not, please let me know and I will be happy to provide more info, is there a way to achieve this?

Any help is greatly appreciated.


texts: magento phtml file infinite scroll via ajax data?

texts:
I have a text box and a div associated with this, I need to show data via ajax query, because via autoload js data is showing very slow in div that give suggestion box effect?

I just want that , if I type 3 letter in textbox an div appear as dropdown for textbox and fetch data based similar like data in textbox (via like statement in query's where clause) and show 5 records in div, when I will scroll it show more 5 records then if I scroll again, 5 new.

How can achieve this.
thanks.


texts: how to get order shipment comments in MG2 using DI ( dependecency injection)

texts:
I can obtain shipment object from Observer object as follows.

$shipment = $observer->getEvent()->getShipment();

But from here how can I get shipment comments? I mean the comment added in Shipment admin page.

Thank you,


texts: Magento 2.3.5 Place order "your session has expired"

texts:
So i have a problem with my magento 2.3.5 checkout. When i fill the checkout form and press "Place Order" i get "Your session has expired" and it refreshes the page and when i try it again the same happens.
Im not using a localhost.


texts: Receiving object specific class which was injected in constructor by three-part extension

texts:
For example, anybody can modify this virtual type magento/module-catalog/etc/di.xml:

<virtualType name="Magento\Catalog\Model\Layer\Search\Context" type="Magento\Catalog\Model\Layer\Context">
    <arguments>
        <argument name="collectionProvider" xsi:type="object">Magento\Catalog\Model\Layer\Search\ItemCollectionProvider</argument>
        <argument name="stateKey" xsi:type="object">Magento\Catalog\Model\Layer\Category\StateKey</argument>
        <argument name="collectionFilter" xsi:type="object">Magento\Catalog\Model\Layer\Search\CollectionFilter</argument>
    </arguments>
</virtualType>

Let's assume that instead

Magento\Catalog\Model\Layer\Search\ItemCollectionProvider

now

Vendor\Name\Model\Layer\Search\ItemCollectionProvider

When I implement virtual type
 (Magento\Catalog\Model\Layer\Search\Context) in own class constructor I get fatal error:

  Class Magento\Catalog\Model\Layer\Search\Context does not exist

It seems, that using of virtual types is allowed only in di.xml

I can inject in own class the class which use this context, but context is the protected property and i can't get it.

How I can find class
Vendor\Name\Model\Layer\Search\ItemCollectionProvider
from any place of code?


texts: How to show Promotion description on associated product page

texts:
I have created a promotional shopping cart price rule for category id 87 as shown in below image-

Now I want to show its description on all those product's view page on frontend which satisfy this rule like in  my case this description should show on all products which are under category with id 87

On product view page at frontend I want to show promotional description as shown in below image--


texts: Price In Configurable Product is 0 in REST API Response : Magento 2

texts:
In Configurable products REST API, the price response is 0, so I need to get ride of it.

I knew later that configurable products prices are displayed in the web store as the smallest price listed in its children simple products and the solution is to make custom API to loop in its related simple products and return the smallest price.

The problem is I return configurable products in many APIs (Search, List products in categories, Featured products, Latest products, ...etc), So I think it is bad practice to loop on each API to make it custom, so I had an idea which make product attribute non visible and make its value automatically read the price attribute.

Is that correct and how can I achieve that?

OR, If there is a better solution, kindly share it.


texts: Hebrew words in PDF invoice are reversed and currency symbol not showing

texts:
I'm using magento 2 CE 2.1.3

When I'm trying to prin PDF invoice the hebrew words are reversed, for example:
םולש instead of שלום.
And also the currency symbol (NIS ₪) is not showing.

I have seen this issue in several places:
https://stackoverflow.com/questions/25911650/rupee-symbol-not-rendering-properly-on-invoice-pdf-in-magento

How can I display `₹` properly in invoice pdf without changing core files

but these solutions doesn't work on magento 2.
The closest thing I have found to change the font in the PDF is this:
Adding new fonts to Pdf invoice Magento 2?

but I couldn't understand completely what I should place in the AddFontToPdf.php file...

I'll be glad for some help here..

Thanks.


texts: How to add custom options programmatically for configurable product in Magento 2

texts:
I tried to add custom option to a product into an observer on catalog_product_save_after event.

I am already successful add custom option for the simple product with this script:

class Productsaveafter implements ObserverInterface
{
    protected $ObjectManager;
    protected $product;

    public function __construct(
         \Magento\Framework\ObjectManagerInterface $ObjectManager,
         \Magento\Catalog\Model\Product $product
      ){

        $this->_objectManager = $ObjectManager;
        $this->_product = $product;

     }
    public function execute(
        \Magento\Framework\Event\Observer $observer
    )
    {

         $_product = $observer->getProduct();
         $productId = $_product->getId();
         $personalisatie = $_product->getData('personalisatie_toevoegen');

         if(!$_product->getHasOptions() && $personalisatie==1 ){

        try{
                $customOption = $this->_objectManager->create('Magento\Catalog\Api\Data\ProductCustomOptionInterface');
                $var = NULL;
                $customOption
                ->setOptionId($var)
                ->setProductId($productId)
                ->setType('field')
                ->setIsRequire("0")
                ->setSku("")
                ->setMaxCharacters("13")
                ->setFileExtension("")
                ->setImageSizeX("0")
                ->setImageSizeY("0")
                ->setSortOrder("1")
                ->setDefaultTitle("Naam")
                ->setStoreTitle("Naam")
                ->setTitle("Naam")
                ->setDefaultPrice("0.00")
                ->setDefaultPriceType("fixed")
                ->setStorePrice("0.00")
                ->setStorePriceType("0.00")
                ->setPrice("10")
                ->setPriceType('fixed')
                ->setRecordId("0")
                ->setProductSku($_product->getSku());

                $customOptions[] = $customOption;

                $_product->setOptions($customOptions)->save();

            } catch (\Exception $e) {
                var_dump($e->getMessage());

            }

         }

    }
}

But for the configurable product is not working at all.

What i see is that !$_product->getHasOptions() is not true. so the code is not executed for configurable product.

If I remove !$_product->getHasOptions() form if statement when i press save of the produc my backend page is loading for few minutes then and page is blocked and the custom options is not added.

Is there another way to add custom option for the configurable products?


texts: Magento 2 developer mode doesn't generates Interceptors

texts:
If a class has plugins and the deploy mode is set to developer the ObjectManager is supposed to generate an Interceptor of the class as needed. That's what happens when running bin/magento setup:di:compile.

In my case some Inteceptors are not generated even tho the class has at least one plugin.

I'm trying to add a plugin for a third party class. di.xml and the after method are declared correctly and the target method is called. Due to the missing Interceptor the plugin isn't executed.

If I run bin/magento setup:di:compile the Interceptor is generated and the plugin works as intended.

I tried to debug into \Magento\Framework\Interception\ObjectManager\Config\Developer::getInstanceType but here I don't get an instance of the class I target with the plugin.

Any ideas what the problem could be?

Update:
I've debugged into the index.php and checked the state of $app. _appMode is set to developer. So I don't think the app mode is overwritten somewhere.


texts:
I'm struggled with a problem with my email confirmation order notification system (which are not sent) while other emails (such as invoice mail) are correctly sent.

I haven't found any post with this problem, does anyone can help me?

Ps: I am currently migrating a plateform from OpenCart to Magento. (During this period both plateforms are running on the same server   and magento is running under a subdomain name).
Thanks a lot in advance for your help


texts:
I have recently bought a extension for mobile otp, which had created its registration form where the mobile OTP function is working. please see the screenshot below.

Now apart from this I have 2 other forms for registering, which doesn't have this Mobile OTP verifying function. Please check the screenshot below

So I want to enable, Mobile OTP functionality in these 2 registration forms as well, so how can I do this. Please if anyone can help me out.


texts: Magento 2 : Saved Credit cards in a dropdown in custom payment

texts:
I have an online payment module where a user will be redirected to merchant page and by entering credit card details, the order will be created.I am saving those credit card details in db.

And I need to show those saved cards as a dropdown on a checkout page.

So For that I have created a new custom offline payment module where I need  to show those details in dropdown and on selecting particular credit card, those details need to attach to payment object and order being placed

Can you please guide on how to achieve it in magento2 as the payment code is rendering from HTML pages


texts: How to get acting to product price rule in Magento 2

texts:
/magento-catalog/templates/product/price/final_price.phtml

<span class="old-price">
    <?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
        'display_label'     => __('Regular Price'),
        'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
        'price_type'        => 'oldPrice',
        'include_container' => true,
        'skip_adjustments'  => true,
        'economy_settings'  => $block->getEconomySettings()
    ]); ?>
</span>

Function $block->hasSpecialPrice() looks like

public function hasSpecialPrice()
{
    $displayRegularPrice = $this->getPriceType(Price\RegularPrice::PRICE_CODE)->getAmount()->getValue();
    $displayFinalPrice = $this->getPriceType(Price\FinalPrice::PRICE_CODE)->getAmount()->getValue();
    return $displayFinalPrice < $displayRegularPrice;
}

How can i find what cause discount to this product. For example i want to know what price rule discount is percentage or value.
it could be price rule for product catalog or price rule for cart.
Any ideas? Thanks!


texts: Magento 2 - How to load image from theme in frontend?

texts:
I uploaded the image amazon-pay-ic.svg to THEME/web/images/.
How can I load it in the frontend?
I tried www.example.com/images/amazon-pay-ic.svg but it does not work and shows the 404 site.


texts:
I am struggling to find how to use the carts/mine/payment-information REST API with PayPal Payflow Pro, which uses either a vault ID to reference a stored card in the vault, or with a new credit card itself.
Does anybody know of the attribute key pairs necessary to perform the call for both methods?


texts: Product page problem with full page cache

texts:
First problem: Product page not showing anything

Main site: postme.com.my
Category page: postme.com.my/promotions
Sub-category page: postme.com.my/promotions/deepavali.html
Product page: postme.com.my/promotions/deepavali/deepavali-hampers-4.html

Here is the background of our issue. Both apps and database server's specs are as below:

Magento Enterprise 1.10
OS: Red Hat Enterprise (32-bit)
Apache, PHP, MySQL
No of CPU: 8
Memory: 32GB
Space: 500GB SCSI

Second problem: The space for /var on DB server was only allocated to 20GB (not my fault). Normal utilization will consume around 80-90% of space. At 91-93%, the DB server will crash.

Normally, the site will work properly during the first 20 days of the month. The last 10 days, it will behave strangely such as:

Product page is not viewable
System will tend to go very slow
at some stage, only homepage is accessible

The culprit is still unknown. In Mozilla Firefox it will return Connection Refused Error (111). On Google Chrome, it return Error Code 64:Host not available.

Some part of the log can be found here:
system.log
exception.log

Any idea?


texts: Redirecting old website to Magento website

texts:
I already finished my Magento website, now I need to redirect all old website urls to Magento url pages.

I already did "Auto-redirect to Base URL" to "Yes (301 Moved permanently)".

By the way the old website and Magento "new website" are in the same root directory, I just renamed the old index.html to indexold.html for the old website.

Thank you in advance


texts: How to use mysql where condition in magento

texts:
I want to write this query in magento

SELECT * FROM user WHERE user_id = 1 AND name = 'abc';

So far I tried this:

$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$table = $this->getMainTable();
$where = $this->_getReadAdapter()->quoteInto("user_id = ?", 1);
       $select = $this->_getReadAdapter()->select()->from($table,array('firstname'))->where($where);
       $data = $this->_getReadAdapter()->fetchOne($select);
       print_r($data);

I don't know how to combine two where conditions and print all rows that satisfy particular condition.


texts: Magento 2.1 SKU missing from order details

texts:
We have a  strange issue in that for only some products the SKU is not being carried through on to the order details. So when you look at the order in admin the SKU is missing. It is actually missing from the database within sales_order_item table.

I'm not even sure where to start looking in to this seen as it works for some products just fine. I've compared products and they look identicle as far as I can see.

Any help would be appreciated.

Here is a screenshot of the admin - see how the SKU's are missing from 3 lines but not the top one...

Here is a screenshot of the database table - see how the SKU values are NULL...


texts:
I wanted to make a duplicate product. SO i did save and duplicate and a product was created.
For product 1,SEO url is gin-glasses-pasabahce-timeless
For product 2 , SEO url is gin-glasses-pasabahce-timeless-1

On my site, only the first product is accessible and not the second one.
What can be the issue.


texts: IE 11 Magento 2.1.15 Braintree - Place Order Button is not working

texts:
In Internet Explorer 11, when Braintree Payment Method is chosen Place Order button is not working. The Magento version is 2.1.15. I am using One Step Checkout. Place Order is not working fine in default one-page checkout too. The error does occur only in IE 11 whereas in Edge and other browsers it is working normally.

Found few errors in the browser console

  SCRIPT5: Access is Denied

https://prnt.sc/n3owdv

Few scripts from https://assets.braintreegateway.com are being blocked by the browser. Tried adding the link to trusted sites and did more configuration changes. Although the script is being blocked.

How to resolve this error? Any help is needful.


texts: I am getting this error when I click on edit customer in the admin back-end panel


texts: How can I limit products that can be bought / added to cart?

texts:
Our store basically sells 6 month and annual subscriptions to our businesses website.

I was wondering if there was a way to make it so that they can only add one subscription (product) to the cart, not multiples, so customers don't make the mistake of buying double subscriptions.

I know you can limit the number of each individual products than can be added to the cart in the inventory tab but that's not quite what I'm after.

So basically what I want is to limit it to one product per order, not one of each product per order. Does that make sense?


texts:
I've just installed Magento on my localhost (XAMPP) server and I can't do anything with my panel.
I can only do click on "Dashboard" and "Find partners & extensions".

Also, I can't see any interface icons.

I let you here a screen of my interface.
I hope you can help me. Thanks beforehand.


texts: How to create attribute set and attribute in Magento 2 programtically

texts:
I want to create attribute set and attribute. Then I want to assign the created attribute under the created attribute set.

I have created module.xml in app/code/Demo/Mymodule/etc:

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Demo_Mymodule" setup_version="1.0.0"></module>
 <sequence>
            <module name="Magento_Catalog"/>
 </sequence>
</config>

and registration.php in app/code/Demo/Mymodule

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Demo_Mymodule',
    __DIR__
);

Then, I have created InstallData.php in app/code/Demo/Mymodule/Setup:

<?php
namespace Demo\Mymodule\Setup;

use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;

class InstallData implements InstallDataInterface
{
    private $eavSetupFactory;
    private $attributeSetFactory;
    private $attributeSet;
    private $categorySetupFactory;

    public function __construct(EavSetupFactory $eavSetupFactory, AttributeSetFactory $attributeSetFactory, CategorySetupFactory $categorySetupFactory )
        {
            $this->eavSetupFactory = $eavSetupFactory;
            $this->attributeSetFactory = $attributeSetFactory;
            $this->categorySetupFactory = $categorySetupFactory;
        }

    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

                // CREATE ATTRIBUTE SET
        $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);

        $attributeSet = $this->attributeSetFactory->create();
        $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
        $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
        $data = [
            'attribute_set_name' => 'Mydemo',
            'entity_type_id' => $entityTypeId,
            'sort_order' => 200,
        ];
        $attributeSet->setData($data);
        $attributeSet->validate();
        $attributeSet->save();
        $attributeSet->initFromSkeleton($attributeSetId);
        $attributeSet->save();

                // CREATE PRODUCT ATTRIBUTE
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

            $eavSetup->addAttribute(
                    \Magento\Catalog\Model\Product::ENTITY,
                'new_text',
                [
                    'type' => 'varchar',
                    'label' => 'My Text',
                    'backend' => '',
                    'input' => 'textfield',
                    'wysiwyg_enabled'   => false,
                    'source' => '',
                    'required' => false,
                    'sort_order' => 5,
                    'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
                    'used_in_product_listing' => true,
                    'visible_on_front' => true,
                    'attribute_set_id' => 'Mydemo',
            ]
        );

        $setup->endSetup();
    }

} ?>

But still not working.


texts: What is the best way to translate Magento?

texts:
I am trying to have my Magento work in french. Should I use a module for this or id there another better way?

This is the module I am looking at: http://www.magentocommerce.com/magento-connect/magento-community-modules-french-france-language-pack.html

I am unsure if this is the best module for this or if I should follow another path.

What are the best strategies for translation and should I use this module?


texts: increasing magento efficiency by loading outside of looping strctures

texts:
Is there a good method for me to work around needing to load these products within the foreach loops?  This is found in so many places within my codebase.  Any suggestions would be appreciated.

            $similarParts = $this->getSimilarParts();
            $productIds = $this->getSimilarProductIds($similarParts);
            foreach($productIds as $product){
                $childProduct=Mage::getModel('catalog/product')->load($product);
                $url = Mage::getBaseUrl() . $childProduct->getUrlKey() . '/p' . $this->getRelatedSku($childProduct). '/';
                echo $this->getRelatedSku($childProduct);
            }

            public function getSimilarParts(){

                $categories = $this->getProduct()->getCategoryIds();
                $collection = Mage::getModel('catalog/category');
                $match = false;

                foreach($categories as $categoryId){
                    $category = $collection->load($categoryId);
                    $categoryName = $category->getName();
                    $startWith=substr($categoryNumber,0,1);
                    $zeros = $strpos($categoryNumber,'0000');
                    if(Mage::app()->getStore()->getCode() === "default"){
                        if($zeros == false && $startsWith == '6'){
                            $match = $category;
                        }
                    }
                }
                return $match;
            }

            public function getSimilarProductIds($similarParts) {

                $productIds = array();
                $productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($similarParts);
                $count = 0;

                foreach ($productCollection as $product) {
                    if ($product->getId() !== $this->_getProductId()) {
                        if ($count < 5) {
                            $productIds[] = $product->getId();
                            $count++;
                        } else {
                            break;
                        }
                    }
                }

                return $productIds;
            }


texts:
Good Afternoon,

I apologise if I ask or say anything seemingly ignorant or stupid however I am very new to Magento.

I work for a company that sells laptop LCD panels all over the world. We have been selling on websites such as Amazon and eBay for many years now and I've recently been tasked with setting the company up with our own online shop.

So far it all seems fairly self explanatory, and there's a wealth of knowledge available which is great. However...

We have thousands of eBay listings for one stock category on our database. Say one type of laptop LCD might fit 300 or different models of laptop, we would have an auction with each model in the title so that buyers can find the screen they need easily.

What I'm hoping to find out how we could possibly replicate this situation on Magento Community 2.3.1.

Ideally I'd like to be able to set up multiple products(?) that link to one category on our database, but with the added functionality that a purchase from any of these products reduces the stock level of the category as a whole.

Is there a way to do this with something like product options (1 product with a massive amount of options) or another way this can be done using an extension maybe?

Any information would be great as I would really like to get the stock management as accurate as possible.

Any pointers with this would be fantastic.


texts:
I actually wanna add sub total, total excluding tax and subtotal including tax in my invoice grid in the admin backend of magento.
I know I have to change app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php, and I'm watching this file, but no idea of how to change it to make my wish.

-> I'm on Magento 1.8.1


texts: Give option in Address Information tab on checkout page

texts:
I want to add address option in Address Information on checkout page

1) Private customer
2) Business customer
3) Public customer

Radio buttons when user select one it show related fields on same place.

How I add this functionality?


texts: magento 1.9 chinese language pack not found

texts:
I searched for magento 1 chenese language but not found any extension.

Can you please suggest me if any link for this package.

thanks


texts: How to clone a shopping cart price rule in Magento 2?

texts: I'm having Multiple shopping cart price rules and having a lot of promotions. I want to clone/copy the shopping cart price rule. Is any option available in Magento 2 for that?


texts: How to change 'choose an option' in magento attribute dropdown

texts: I created an Attribute Set. I would like to know if I can change the default option list item wording in the Admin Panel's backend?  See screen shot:


texts: Magento 2 Testing credit card working with Live credential of Authorize.net

texts:
I have the setup Live credential of Authorize.net
I have also configured the production mode and Authorized and capture.

But when I am entering the testing credit card detail it is working.
Please help me why this happened?


texts:
I don't try to set price attribute during product import.
Product is inserted into Magento catalog with its name, sku, description but price attribute is empty.
The code I used is the following:

$product_model = Mage::getModel('catalog/product');
$productId = $product_model->getIdBySku($sku);
$categoriesIds = array($categoryId);
if (!$productId) {
    //inserimento
    $product_model
        ->setSku($sku)
        ->setName($name)
        ->setDescription($description)
        ->setShortDescription($shortDescription)
        ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
        ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
        ->setAttributeSetId(10)
        ->setCategoryIds($categoriesIds)
        ->setPrice($price)
        ->setPrice(11.22)
        ->setCost(22.33)
        ->setSpecialPrice(00.44)
        ->setSpecialFromDate('06/1/2014')
        ->setSpecialToDate('06/30/2014')
        ->setMsrpEnabled(1)
        ->setMsrpDisplayActualPriceType(1)
        ->setMsrp(99.99)
        ->setTaxId(2);
    $qty = 1;
    try {
        $productId = $product_model->save()->getId();
        $product = $product_model->load($productId);
        $product->setQty($qty);
        $product->setIsInStock(1); //->isInStock(1)
        $product->save();
    } catch(Exception $e) {
        Mage::log($e->getMessage());
    }
} else {

}

Can you help me, please?
Thanks!!


texts: How to fix "There are no commands define in the namespace" error?

texts:
I have upgraded the Magento version from 2.2.6 to 2.3.0 via composer. I have tried running the command php bin/magento setup:upgrade but it says the below error

  There are no commands defined in the "setup" namespace

What could be the issue?

Please, anyone, help me


texts: how to change the system attribute scope from store to website

texts:
I am using magento 1.8.
Note:  I am using Advanced Permission to restrict user to a one store.

I am developing multistore appication where I need to set product visibility = catalog, search for all the store.

Means no need to select visibility in individual store scope.
How can I set the product visibility scope global/website from store

How can I change the scope from store to global/website level

Thank you


texts: Multi-website language switcher not showing

texts:
This is my first time creating a multi-lingual webshop, so first I created 2 storeviews, where the switcher was working fine. Then I found out that I needed to create multi-websites instead.
I did it in the same process, but it is not working now.
I've added a few screenshots so you can see what I have done.


texts: How can i Bulk export Media/import files as Excel Sheet (Export only Name of all images)

texts:
How can i bulk export name of all images presented in the media/import fils in magento root folder?

Note : Is possible export via SSH


texts: How can I add a label to checkout addresses fields?


texts: Initialise a Jquery Widget on Demand with Jquery

texts:
I have loaded my layered navigation over ajax to speed up my site load. The layered navigation also uses ajax and it's jQuery is normally initialised via RequireJS i believe with the below requireJS config:

var config = {
"map": {
    "*": {
        "productListToolbarForm": "CzoneTech_AjaxifiedCatalog/js/product/list/toolbar"
    }
  }
};

This i think overrides the default functionality of Magento's productListToolbarForm widget which Magento initialises on category pages.

As the markup isn't there on page load i need to initialise this in the success function of my ajax call for the layered nav so the markup is present when this jQuery runs.

The Widget looks like below:

$.widget('mage.productListToolbarForm', $.mage.productListToolbarForm, {
    ...
}

I have tried:

$('#layered-filter-block').productListToolbarForm();

This seems to work when i use chrome however not when i use safari or internet explorer. How can i properly initialise this JS when my ajax call completes?


texts: After installing magento 2.1.17 admin login page cant display properly

texts:
After installing Magento 2.1.7, When I am trying to open the admin panel login screen is blank and my console contains an error.if anyone has a solution then please let me know.
I check in this file  -

  /vendor/magento/framework/View/Element/Template/File/Validator.php

in line number there is a code like :-:138

foreach($directories as $directory)
   {
     if(0===strpos($this->fileDriver->getRealPath($path),$directory))
     {
      return true;
     }
  }


texts:
I need to create input on

  store->configuration

that set front name to module. How can I do it ? Sorry, but I don’t know how I can start.

For example: I input :”test”, and URL is mysite.loc/test. Controller index.php in index directory

Thank You !


texts: Magento 2 : How to create Custom admin theme?

texts: How to create Custom admin theme and apply in back end ?


texts:
How to show the new field if the user is guest.
If the user logged in dont show the custom field which been created.

     public function process($result)
     {
        if ($this->customerSession->isLoggedIn()) {
            return;
        } else {
            $result = $this->getShippingFormFields($result);
            $result = $this->getBillingFormFields($result);
            return $result;
        }
    }

  I have tried doing this and I get Error code 500. Is there any way? I
  could show the new field for guest users ONLY if not continue as
  Normal.

I have created a date picker in checkout page


texts: How to decrypt magento community edition password?

texts: I am storing customer info using observer and need to store password in plain text.


texts: Is it possible to bypass model_save_before observers?

texts:
I have a strange issue which I think I narrowed down to observers occasionally not being triggered.

Situation:

An Observer for sales_order_invoice_save_before (in the global node), serializes some custom attributes. In most cases, this works fine, but in ~5% of the cases I get the string Array in sales_flat_order_invoice, as if the observer was not triggered.

I did not find out yet, what these orders/invoices have in common, but I want to be sure that I am on the right track and the issue isnt't somewhere else.

Question:

In which cases is it possible that models are saved without dispatching their {$eventPrefix}_save_before event? I can only imagine raw SQL queries but maybe I am missing something?


texts: Problem importing images from a CSV file - Magento ver. 1.9.2.2

texts:
Magento ver. 1.9.2.2

I've been working on this issue for several days and have read numerous articles. I have uncovered a few clues but can't tell where the hang up is.

Here is a link to a test CSV file used for importing:
http://webventions.com/wilsonandson/test_import.csv

The file was based on an export from Magento.

The media images used on the product pages don't import.
The main, small, and thumbnail image all load and show on the front end. However, they do not show up on the back-end.

The media image files have been moved by the import tool from the "import" folder to the "catalog-product" folder, and the images "test2.png" and "test3.png" do show up in the importexport_importdata database table.

Below is an SQL snippet from the database dump:

"_media_attribute_id":"88","_media_image":"test2.png","_media_lable":null,"_media_position":null,"_media_is_disabled":null}

Media attribute id #88 is the id of the media_gallery attribute.
Also tried using the id for the gallery attribute with no success.
Does anyone have any advice for where to look?


texts: add images to additional info product tab

texts:
I'm newbie in magento, I have to add image instead of text in one value of the additional info tab in the product's page.
How can I do this job?


texts:
We are running Magento Entperise 1.14.4.2.

Access log file is getting filled with "MagentoCrawler" entries and drags performance.

It stops after the server reboot. But starts back the next day.

Added .htaccess entries. But that did't stop it.

Any Thoughts?

Thanks for your help and Merry Christmas!


texts: How to copy category and add to another category?

texts:
I have subcategory. I want move copy of it to another category. I do following

    $copy = clone $category;
    $copy->setId(null) // Remove the ID.
        ->save();
    $copy->move($parentCategory->getId());

This works, but new category have same name for each store. I have 5 stores with different languages. So category I want to copy have different name for each store.

Any ideas how to copy categories with different names for each store?

Edit:

Since I've accepted answer I've occurred issue - names weren't save correct for all stores. So I suggest use just

$copy = Mage::getModel('catalog/category');

instead

$copy = clone $category;
$copy->setId(null);


texts: /rest/default/V1/guest-carts/{cartId}/totals-information 404 magento 2

texts:
when Visitor add a product to cart.

Go to Cart Page.
Click on Proceed to Checkout
Login Pop-up will prompt to login.

When try to login it shows alert box with error
"No such entity with
%fieldName = %fieldValue".

However we successfully logged into website but prior login show the above error and in console shows 404 error.
Note: Guest Checkout is disabled in our site.
Please suggest a solution.Thanks


texts: Magento 2 : how to perform operation after product price update from backend

texts: I have added the product into the cart and want to send email to the customer after the same product's price change from the backend.


texts:
I'm trying to move to Magento 2 finally.
And was trying to install a module from GitHub via composer.

I tried it on my localhost first and everything worked perfectly,
I executed: php ./vendor/composer/composer/bin/composer require adyen/module-payment, then I was asked to log in repo.magento.com which I did, and it installed with no problems.

But, when I try to do it on the server, I'm not asked to log in repo.magento.com, I just get an error that I have to:

So how do I authenticate?


texts: Magento-2 installer not moving beyond step 5

texts:
I have been trying to install magento-2 since over a week now but each time the magento installer gets stuck at step-5 ( see attached picture of screen)

The next button clicks, but is irresponsive.

The magento version I am installing is version 2.1.5

Any help or advise is very much appreciated.

Thank you.


texts:
I'm using a fairly new Magento 1.8.0.0 installation, with no changes to the core.
When trying to make a tax rate at 0%, Magento returns the following error upon save:
Rate Percent should be a positive number.

I'm recreating a Magento webshop, based on a Magento 1.4.2.0 installation, in which the exact same values have been set.

Is this just a bug in Magento 1.8, keeping me from setting a tax rate with 0% tax, or am I missing something?

Any help would be appreciated.


texts: Why does the Magento app run so many times?

texts:
As I've been through debugging a number of issues, I can't help but notice that the same methods get called over and over again. For instance, I ran a stack trace function to log the paths through which the _initStores() method in App.php gets called when saving from the admin configuration menu, and it turns out that three of the four calls to this function come from the exact same stack of calls.

2016-09-15T15:05:11+00:00 DEBUG (7):    1) /www/sites/dev.site.com/files/html/index.php(91): Mage::run('', 'store')
    2) /www/sites/dev.site.com/files/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
    3) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
    4) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores()
2016-09-15T15:05:16+00:00 DEBUG (7):    1) /www/sites/dev.site.com/files/html/index.php(91): Mage::run('', 'store')
    2) /www/sites/dev.site.com/files/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
    3) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
    4) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores()
2016-09-15T15:05:19+00:00 DEBUG (7):    1) /www/sites/dev.site.com/files/html/index.php(91): Mage::run('', 'store')
    2) /www/sites/dev.site.com/files/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
    3) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    4) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_StandardOverriddenClass->match(Object(Mage_Core_Controller_Request_Http))
    5) /www/sites/dev.site.com/files/html/var/cache/ew/files/69/b9/Mage/Core/Controller/Varien/Router/Standard.php(273): Mage_Core_Controller_Varien_Action->dispatch('save')
    6) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_System_ConfigController->saveAction()
    7) /www/sites/dev.site.com/files/html/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php(183): Mage_Core_Model_App->reinitStores()
    8) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(598): Mage_Core_Model_App->_initStores()
2016-09-15T15:05:19+00:00 DEBUG (7):    1) /www/sites/dev.site.com/files/html/index.php(91): Mage::run('', 'store')
    2) /www/sites/dev.site.com/files/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
    3) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
    4) /www/sites/dev.site.com/files/html/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores()

What is the purpose of this running through the same functions so many times? Doesn't this slow down the entire platform?


texts: magento 2 cant login via admin despite following several threads

texts:
I have a real stumper, I cannot access admin despite knowing the password is correct

I have followed the magento 2 steps to reset password via email - I don't get the email resend request
I have done the SQL change and followed step by step from this link: https://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/magento1/resetting-the-magento-administrator-password#Magento-2 which outlines how to update the SQL password using the cryptographic salt.
I have unlocked the only admin user via shell
I have created a new user via SQL which is live in SQL but produces the same error "You did not sign in correctly or your account is temporarily disabled"

I cant think of anything else to try! I know my Password is correct, i know the password for the SQL user i made is correct!

Any ideas please?


texts: Magento 2: PDF set page margins for Invoice

texts:
I added a footer to my invoices, this works fine.

private function _insertFooter($page) {

    $this->_setFontRegular($page, 8);

    $this->y = 100;
    $page->drawLine(25, $this->y, 570, $this->y);
    $this->y -= 15;

    $page->drawText('My Shop', 30, $this->y, 'UTF-8');
    $page->drawText('Address', 30, $this->y - 10, 'UTF-8');
    $page->drawText('ZIP City', 30, $this->y - 20, 'UTF-8');
    $page->drawText('Country', 30, $this->y - 30, 'UTF-8');
    $this->_setFontRegular($page, 10);

}

I add this function into the getPDF() function

/**
     * Return PDF document
     *
     * @param array|Collection $invoices
     * @return \Zend_Pdf
     */
    public function getPdf($invoices = [])
    {
        $this->_beforeGetPdf();
        $this->_initRenderer('invoice');

    $pdf = new \Zend_Pdf();
    $this->_setPdf($pdf);
    $style = new \Zend_Pdf_Style();
    $this->_setFontBold($style, 10);

    foreach ($invoices as $invoice) {
        [...]
    }
    $this->_insertFooter($page); // <-- my footer stuff
    $this->_afterGetPdf();
    return $pdf;
}

Perfect, the footer is shown. But when there are several items in this invoice (so the table is too long), the product table overlaps the footer. I guess it would be easy to set page margins (like in html2pdf)... But how can I do that - I'm not fimilar with Zend yet. Or is this possible?


texts: Magento2: Admin panel content not loading

texts: Certain areas of admin panel such as Products, CMS Pages and Blocks are not loading (loading gif keeps going forever). I can see other parts though such as categories or widgets and able to make changes and save them without any problem and website frontend reflects the changes but above mentioned elements won't load even if you refresh or log out and log back in.


texts: How to create a template for page content in custom module?

texts:
I've created a module that includes a custom page. I can set a template block for the page title as follows:
<?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="page.main.title" template="JR2_MonthlySubscription::monthly_subscription.phtml" />
        <!--
        <referenceBlock name="page.main.title">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">MYA_Subscribe::title.phtml</argument>
            </action>
        </referenceBlock>
        !-->
    </body>
</page>

This works fine, but how do I set a template for the actual page content? I've tried adding a reference block for page.wrapper to no avail. The documentation doesn't seem to mention the available page options for name.


texts:
What is the standard procedure or the best solution to add a new link to the product.info.addto block.

Currently I have modified the following file
app/design/frontend/base/default/template/catalog/product/view/addto.phtml by adding an extra <li> to the existing link.

What I am worried is whether this will affect future upgrades and if so, what could be the solution.

EDITED
I need to add a link "Add to Favorites" near "Add to Wishlist" and "Add to Compare".


texts: Access Denied errors after installing SUPEE-6285

texts:
After installing the SUPEE-6285 patch on our Magento 1.7.0.2 store the system is showing an "Access Denied" error when attempting to access all custom modules for users who have selective permissions (not all permissions). Screenshot below.

The user permissions are properly set in Role Resources and we have re-applied the permission settings to ensure these are set.

The problem has been reproduced across multiple custom extensions so it isn't just a single extension that isn't working.

I have logged out/in, cleared the cache and confirmed that the compiler is disabled.

Can anyone suggest how to troubleshoot this?


texts: Change Account login text to icon, standard magento or any other

texts:
Where do I start if I want to update the text of login on the frontend to a icon?
I have installed grunt, downloaded the css libraries and icon sets but Im stuck. A hint?

I also wonder how I can convert the login text link to a custom button..


texts: How to translate magento 2.3.2 frontend only

texts:
I would manually translate but how do i do this?

I remember at magento 1, we can find an en_US excell file at file manager and edit it as needed

how do i find this same file at magento2, and will this method works?

I'm at magento 2.3.2


texts: Magento 2: Allow empty query field in search

texts:
On the webshop that I'm working on, the user can find products by choosing filters (attributes like color/size/category) and/or entering a search query, the search results are then displayed on the search results page. However, when the search text is left empty, Magento redirects to the homepage instead of showing results, even if other filters are filled in.

In the admin, I have set the 'Minimal Query Length' to 0, but this doesn't make any difference.

I've created a workaround by setting the search param to '0' before submitting when left empty, which will make Magento display all the products anyway. But it's not a great solution because the string '0' appears everywhere on the page including in the popular search block in the admin page.

Is there an elegant way to solve this issue without having to override all kinds of core classes?

You can find a demo of the problem here, if you replace the 'q=watch' by 'q=' I want it to show all the products.


texts: Is it is possible to create base theme, which will become a common theme to both the adminhtml and frontend?


texts: Magento 2.2 - How to change default attribute set

texts:
I have two attributes sets

Set1
Set2

While adding the product, By default Set1 is selected for Attribute Set.

I want this default Attribute set to be Set2.
How to change this attribute set.

Where to check set1 is defined as default attribute set.


texts: Magento 2 : add custom message on checkout page on shipping address change

texts:
I want to show custom message under shipping method section.
when address changes message also change/remove.

for example:
When custom select Columbia addess I want to show custom notice/message
again when select india address message will be removed.
Can Any one please guide me which js and html I Need to work.
Note:: You can guide on vendor files changes I will manage override.


texts: Table Rates Based On Final Order Value Magento 2

texts:
I have table rates shipping enabled. Any order over £100 has free shipping.

However, if a discount code is applied that takes it under £100, shipping should be charged. In Magento 2 this is not currently the case, it chooses shipping options based on the total prior to the discount being applied.

Can anyone suggest an update so shipping is calculated on the final value of the order (i.e. after discount codes are applied).


texts:
i want to create luma based theme and set up grunt for it.
path to .less files: frontend///web/css/source/style-l.less
im getting an error: unable to resolve the source file for 'frontend/<vendor>/<name>/en_US/css/source\styles-l.less

local-themes.js below

module.exports = {
blank: {
    area: 'frontend',
    name: 'Magento/blank',
    locale: 'en_US',
    files: [
        'css/styles-m',
        'css/styles-l',
        'css/email',
        'css/email-inline'
    ],
    dsl: 'less'
},
luma: {
    area: 'frontend',
    name: 'Magento/luma',
    locale: 'en_US',
    files: [
        'css/styles-m',
        'css/styles-l'
    ],
    dsl: 'less'
},
backend: {
    area: 'adminhtml',
    name: 'Magento/backend',
    locale: 'en_US',
    files: [
        'css/styles-old',
        'css/styles'
    ],
    dsl: 'less'
},
boo: {
    area: 'frontend',
    name: 'sebu/boo',
    locale: 'en_US',
    files: [
        'css/source/styles-l'
    ],
    dsl: 'less'
}};


texts: Override Adminhtml Translation file with Module

texts:
I am using Magento ce-1.9.2.1 in my site.

It is mainly in nb_NO(Norwegian) language, even in admin panel.

Now I want to add a custom translation file in app/design/adminhtml/default/default/locale/nb_NO - by name Package_Module.csv but with a custom module.

I can't figure out the settings for this in my module's config.xml and the path related stuff.

Please help anyone.


texts: Magento 2 SimpleXMLElement (array to XML stream conversion error)

texts:
$test_array = array (
                    'bla' => 'blub',
                    'foo' => 'bar',
                    'another_array' => array (
                        'stack' => 'overflow',
                    ),
                );
$xml = new SimpleXMLElement('<root/>');
array_walk_recursive($test_array, array ($xml, 'addChild'));
$xmldata =$xml->asXML();

But its showing

  fatal error:SimpleXMLElement' not found.

I used same thing in Magento 1.9 and it worked that time.


texts: i have an issue not rating is showing on my plp page there is always show "write a review" but when i open the detail page there review stars showing i have enable all reviews and approved what will be the issue i am using sm custom theme.


texts: How to get every values for a specific attribute id by product id?

texts: What I am trying to do is to create a link from the parent URL to preselect some attributes for a configurable product. For example. http://localhost/magento-product/#{attribute_id} = {value}. I want to do this for all products that contains these attributes that requires for example size/color. Is there a dynamically way to do this?


texts: magento 2 redirect url with parameters from controller

texts:
I am trying to redirect to a different controller from one controller . I also want to set an Url parameter along with the redirect. But this is throwing me an error

  Uncaught Error: Call to undefined method
  Magento\Backend\Model\View\Result\Redirect\Interceptor::setParam()

Here is my code.

public function execute()
{

    $resultRedirect = $this->resultRedirectFactory->create();
    $resultRedirect->setPath('customer/index/new');
    $resultRedirect->setParam('myname', 'Nuno Sousa');
    return $resultRedirect;
}

What is wrong with the above code? or is there any other way?


texts: How to add a canonical tag on the login page

texts: Whats the best way to add a canonical tag to the login page? Would I be best to add something to the head via the layout.xml


texts: Magento2: How can I add custom Drop down field in registration form

texts:
I want to add a drop down field (Account type) and get this value in admin just like other fields values.
How can I add custom field in registration form


texts:
We display the manufacture suggested retail price on product and category page, but I want to edit our rule that when there is an special price, the msrp is hidden.

We use this code to display the msrp:

<?php $_price = $this->helper('tax')->getPrice($_product, $_product->getMsrp()) ?>
    <?php if ($_product->getMsrp()): ?>
    <?php $_msrpPrice = $this->helper('core')->currency($_product->getMsrp(),true,true) ?>

    <span class="old-price" id="product-price-<?php echo $_product->getId() ?><?php echo $this->getIdSuffix() ?>"><?php echo $_msrpPrice ?>

<?php endif; ?>

What addition do I need to hide this, when there is an special price for that product?


texts:
i am new to magento and have no developer skills but i can do bit of copy pasting etc very well.

i have recently migrated the server and now i am facing some issue with our database.
please follow this link for error

http://www.smartteck.co.uk/storage/solid-state-drives-ssd.html?feature_394=N

when ever on our site you use any filter it give this error. i have contacted STIC but they have the worst customer support ever.

can any one read the error and tel me how to sort this issue?

Thanks in advance.


texts: How to change the position of Short Description in Front End?

texts:
I want to change the position of short description to below the price.

How can I do it?


texts: Magento 2 : How to override files from Magento core framework?

texts:
Actually I'm refering to #19247 for PHP 7.2 specific issue.

that partially solved  my issue but can't able to override that file.

I tried using preference here's what I tried.
<preference for="Magento\Framework\File\Uploader" type="Vendor\Module\File\Uploader" />

But doesn't seems to work. Any idea ?


texts: Including Jquery in magento conflict the prototype.js

texts:
I cannot include Jquery in magento because after including jquery-2.2.2.min.js in magento admin side,it have conflict with prototype.js.
Adding $.noConflict(); can remove the conflict,but the jquery will not work then.This is the actual problem.


texts: Magento theme redirects to wrong path for css files

texts:
I know this question gets asked A LOT on this forum, but I just cannot get the url to change. I'm working on a test-site to try out a new theme (fortis), and no matter what I do it tries to retrieve the styling files from the old website URL instead of the new one.

What I've tried so far:

Change base URL
Change secure / unsecure URL
Gone through and edited all basic xml files (like local.xml) and replaced the old url with the new one
Went through the database to check for old links
Spent hours and hours just trying to fix this one thing!

The theme works, it's just this one single problem that it tries to retrieve the styling files from the old url. The path is correct, it's just the base url that is wrong... It really drives me insane that I've changed the base url and for some reason it still tries to get them from the old website... Like... What???

Does anyone have any hints? I'm getting kind of desperate here if you haven't noticed already haha.

Thanks

EDIT: I do not have any caching enabled, and make sure to clear the cache manually anyway just to make sure, but to no avail...


texts: After upgrade from magento 2.3 to magento 2.3.5 page error message not showing while FPC is enabled

texts:
Only Page error messages are not showing at the frontend, When I disable the Full page cache then a page error message appears correctly. Also want to inform that we are using smartwave porto theme at the frontend. Please guide me on this asap. Please check the screenshot
Tried Method:

Checked with default magento luma theme and disabled the third party modules

Looking forward to hearing from as soon as possible


texts: "Encryption" Class Not Found When Downgrading From EE to CE

texts:
I have followed the tutorial on blog.yanted.com and everything seems to be working except for I can not sign in the front or backend. I have copied app/code/core/Enterprise/Pci/Model/Encryption.php to app/code/local/ClientName/Pci/Model/Encryption.php and added the following code. The error I get is Fatal error: Class 'ClientName_Pci_Model_Encryption' not found in /path/includes/src/__default.php on line 18430. Most of what I read says it is a typo but I do not see any... Maybe worth noting I am on Magento 1.7, which seemed to correspond with the release date of my EE version.

app/code/local/ClientName/Pci/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <ClientName_Pci>
            <version>1.11.0.0</version>
        </ClientName_Pci>
    </modules>
    <global>
        <helpers>
           <clientname_pci>
                <class>ClientName_Pci_Helper_Data</class>
            </clientname_pci>
            <core>
              <encryption_model>ClientName_Pci_Model_Encryption</encryption_model>
            </core>
        </helpers>
    </global>
</config>

I then enabled it with app/etc/modules/ClientName_Pci.xml:

<?xml version="1.0"?>
<config>
     <modules>
        <ClientName_Pci>
            <active>true</active>
            <codePool>local</codePool>
        </ClientName_Pci>
     </modules>
</config>

My Encryption model starts out with this (for reference to ClientName):

<?php

class ClientName_Pci_Model_Encryption extends Mage_Core_Model_Encryption
{

Finally, I added this Helper/Data.php file in app/code/local/ClientName/Pci/Helper/ because I read a few places it was sometimes needed.

<?php

class ClientName_Pci_Helper_Data extends Mage_Core_Helper_Abstract
{
}


texts:
I have executed below query in my magento database.

CREATE TABLE IF NOT EXISTS `catalog_product_super_attribute_image` (
  `value_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
  `product_super_attribute_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Product Super Attribute ID',
  `value_index` varchar(255) NOT NULL COMMENT 'Value Index',
  `is_percent` smallint(5) unsigned DEFAULT '0' COMMENT 'Is Percent',
  `image_value` decimal(12,4) DEFAULT NULL COMMENT 'Image Value',
  `website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website ID',
  PRIMARY KEY (`value_id`),
  UNIQUE KEY `UNQ_CAT_PRD_SPR_ATTR_IMAGE_PRD_SPR_ATTR_ID_VAL_IDX_WS_ID` (`product_super_attribute_id`,`value_index`,`website_id`),
  KEY `IDX_CAT_PRD_SPR_ATTR_IMAGE_PRD_SPR_ATTR_ID` (`product_super_attribute_id`),
  KEY `IDX_CATALOG_PRODUCT_SUPER_ATTRIBUTE_IMAGE_WEBSITE_ID` (`website_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='Catalog Product Super Attribute Image Table' AUTO_INCREMENT=3 ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `catalog_product_super_attribute_pricing`
--
ALTER TABLE `catalog_product_super_attribute_image`
  ADD CONSTRAINT `FK_CAT_PRD_SPR_ATTR_IMAGE_WS_ID_CORE_WS_WS_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `FK_CDE8813117106CFAA3AD209358F66332` FOREIGN KEY (`product_super_attribute_id`) REFERENCES `catalog_product_super_attribute` (`product_super_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS=1;

It created the table but prompted the error with constraint creation.
Now when I am trying to run my project it displays me error like below.

I have checked the log file which displayed the error

2014-02-14T07:42:12+00:00 ERR (3): User Error: Some transactions have not been committed or rolled back  in D:\wamp\www\rackworld\lib\Varien\Db\Adapter\Pdo\Mysql.php on line 3645

Please help me out to solve the issue, thanks in advance.


texts:
I am trying to print invoices with special characters (for example for a polish shop).
By default these just get completely cut out. If I (for testing) enter only special characters as the customer's last name, the field in the invoice pdf is completely empty.

I made a new module overwriting the folllowing functions in \app\code\core\Mage\Sales\Model\Order\Pdf\abstract.php

protected function _setFontRegular($object, $size = 7)

protected function _setFontBold($object, $size = 7)

protected function _setFontItalic($object, $size = 7)

to use this font:

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/Fonts/Arial.ttf');

Also I created the folder 'Fonts' in 'lib' and copied the Arial.ttf inside.

The outcome: No effect at all, the pdf stays exactly the same (the module is active in the backend though).

So to make sure there's not just an error in the module somewehere else than in the actual code: I edited the abstract.php directly in \app\code\core\Mage\Sales\Model\Order\Pdf\, but unfortunately still with the same result.

What am I doing wrong?


texts:
I'm getting the following error when trying to run the Magento2 installer on my dev host (apache running on :8080

It's a fresh clone of the dev alpha rev 99. Oddly, I installed an earlier rev (alpha85) a few weeks back and it installed first time, no errors. That instance has since been completely deleted and mysql db instance replaced with a fresh one.

Previously, the install ran under the /pub directory. Pointing to that now creates an infinite redirect and fails. Running at xxx:8080/ causes the error below.

PHP version is 5.5.14, running through a MAMP stack.

Perhaps I deleted my common sense at the same time. Any pointers as to what is missing in my environment or other embarrassingly obvious oversights are greatly appreciated.

Application is not installed yet.
#0 /Volumes/Magento CE Dev/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(202): Magento\Framework\App\Bootstrap->assertInstalled()
#1 /Volumes/Magento CE Dev/magento2/index.php(42): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#2 {main}


texts: Configurable Product - Shows available in category view but Out of Stock in Product View and without Add to Cart button

texts:
4 simple products associated to config product.
-website selected
-all enabled
-all set to instock / avail
-config set to instock
--I've been trouble shooting but cannot seem to create In Stock Visibility under the config product view on the Frontend.

As the title indicates Config Prod shows as avail in category view but once in product view the 'add to cart' button disappears and the Availability shows 'out of stock.

Just need to create drop down options for product with variable features.
Simple task seems impossible at this point. Any guidance would be most appreciated.


texts: Magento 2 - how to set final price for product on view page

texts:
Magento frontend product view page i need to set custom final price,

how to set?  I tried Magento\Catalog\Model\Product\Type\Price.php in this file getFinalprice function but not  working with plugin

can anyone  give suggestion


texts: Magento2 - Search preview not showing up

texts:
I have a custom template file in which I am trying to call search block as showing up in header.

In header the search is rendering through

<?php echo $this->getChildHtml("topSearch"); ?>

In my custom phtml file, I have included the search template as

<?php  echo include ($block->getTemplateFile('Magento_Search::form.mini.phtml')); ?>

This shows up the search field and it's working but it's not showing up the preview.

Means preview result are forming which I can see in devTools but I feel like the preview html is not forming which is not showing the preview div on frontend even it's forming.

Please help.


texts: Magento 2: how to hide product from minicart

texts:
In our store we're offering a free gift that is attached to the product customers can buy, but since they clutter the mini cart I came to the idea of simply hiding those products in it (and still keeping them in cart). My solution was to copy and edit the /vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js and update the getCartItems() and getCartLineItemsCount() and simply splice out those products. But, some products are removed from frontend, while others are not and summary_count is not properly updated.

Updated getCartItems():

getCartItems: function () {
    var items = this.getCartParam('items') || [];
    if (items.length) {
        for(var i = 0; i < items.length; i++){
            if (items[i].product_price_value === 0) {
                items.splice(i,1);
            }
        }
    }

    items = items.slice(parseInt(-this.maxItemsToDisplay, 10));

    this.update(items);

    return items;
},

Updated getCartLineItemsCount():

getCartLineItemsCount: function () {
    var items = this.getCartParam('items') || [];

    if (items.length) {
        for(var i = 0; i < items.length; i++){
            if (items[i].product_price_value === 0) {
                items.splice(i,1);
            }
        }
    }

    return parseInt(items.length, 10);
}

Knockout template (wasn't changed) looks OK and above should work. Is there a better method of doing what I want? Note that setting the Visibility to Not visible individually does not work, because it also hides the product which can be bought separately.
There's not an option to keep two different (same) products for this.

Magento version is 2.2.3.

EDIT:
Forgot to mention, for adding a "free gift/product", we're using Amasty Free Gift plugin.


texts: SQL install script doesn't run in magento2

texts:
I have installed module in magento2 and want to add more field in module table,

So I have deleted the table and update the install script.

After this follow the below command successfully:

- php bin/magento setup:upgrade
- php bin/magento indexer:reindex
- php bin/magento cache:flush

But table is not created in the database.


texts: How Does Magento 2 Apply KnockoutJS Bindings

texts:
Per a very cursory reading of the KnockoutJS documentation, initializing a very basic Knockout view looks like the following

// This is a simple *viewmodel* - JavaScript that defines the data and behavior of your UI
function AppViewModel() {
    this.firstName = "Bert";
    this.lastName = "Bertington";
}

// Activates knockout.js
ko.applyBindings(new AppViewModel());

i.e. -- you create a javascript function intended to be used as an object constructor, instantiate an object from it, and then pass that object into the ko.applyBindings method of the global knockout object (ko)

However, in Magento 2, if you load a backend page with a Grid UI, Magento will initialize the js/core/app.js RequireJS module

/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
define([
    './renderer/types',
    './renderer/layout',
    'Magento_Ui/js/lib/ko/initialize'
], function (types, layout) {
    'use strict';

    return function (data) {
        types.set(data.types);
        layout(data.components);
    };
});

This module, in turn, loads the Magento_Ui/js/lib/ko/initialize module, which appears to initialize Magento's use of KnockoutJS.  However, if you look at the source of initialize module.

define([
    'ko',
    './template/engine',
    'knockoutjs/knockout-repeat',
    'knockoutjs/knockout-fast-foreach',
    'knockoutjs/knockout-es5',
    './bind/scope',
    './bind/staticChecked',
    './bind/datepicker',
    './bind/outer_click',
    './bind/keyboard',
    './bind/optgroup',
    './bind/fadeVisible',
    './bind/mage-init',
    './bind/after-render',
    './bind/i18n',
    './bind/collapsible',
    './bind/autoselect',
    './extender/observable_array',
    './extender/bound-nodes'
], function (ko, templateEngine) {
    'use strict';

    ko.setTemplateEngine(templateEngine);
    ko.applyBindings();
});

You see Magento's called the ko.applyBindings(); object without a view object.  This doesn't make any sense, and I'm not sure if it's my limited understanding of Knockout, or Magento doing something custom/strange here.

Is this where Magento actually applies Knockout bindings? Or does that happen somewhere else?  Or is Magento doing something tricky to intercept Knockout code and process it elsewhere?


texts: Getting “access forbidden by rule” error at magento in nginx server /app/etc/local.xml

texts:
I am getting this error for my website which is built on magento-1.9.0.

2015/07/13 05:50:44 [error] 1371#0: *491517 access forbidden by rule, client: **.***.***.***, server: www.example.com, request: "POST /app/etc/local.xml HTTP/1.1", host: "www.example.com"

For your information: the IP address is always my own server. This only happens whenever I try to edit or update any item of "Shopping Cart Price Rules". There was a magento bug of shopping cart price rule and I have used a extension which is mentioned here https://github.com/husseycoding/cartrulefix . That extension works perfectly in my local environment however it is also not working in live. I guess this error is preventing that extension to work perfectly. My live server is running on nginx.

Could someone please help me? Thanks in advance.


texts: Exclude storeview in hreflang generation

texts:
I use this code for the href language in my head.phtml

<?php $website = Mage::app()->getWebsite()->getStores();
foreach ( $website as $store) {
    $lang = $store->getConfig('general/locale/code');
    echo '<link rel="alternate" href="' . $store->getCurrentUrl() . '" hreflang="' . $store->getCode() . '"/>' . "\n";
}?>

Which gives for all my languages the right storeview. Like:

<link rel=alternate href="http://www.mystore.nl/lifestyle.html?___store=nl&amp;___from_store=nl" hreflang=nl />
<link rel=alternate href="http://www.mystore.co.uk/lifestyle.html?___store=en&amp;___from_store=nl" hreflang=en />
etc....

Only for our app we created an extra storeview mobile. But this isn't a language and Google gives error's over this.

How can i excluded the storeview mobile in this code?


texts:
I want to select a value for status or visibility on a specific product for which I have only the sku.  I have tried many ways but did not arrive a a solution to the problem.  Anyone can help me, thanks in advance

I found this in Magento Forum that may be helpful

SELECT entity_id FROM `catalog_product_entity_int`
WHERE attribute_id = (
SELECT attribute_id FROM `eav_attribute`
WHERE `attribute_code` LIKE 'status'
) AND `catalog_product_entity_int`.value = 2


texts: Adding a new eav attribute type "file upload"

texts:
I need to have the ability to add a file upload at the admin site and process the files after these have been uploaded. As a first step I like to extend Magento eav attributes with a new custom type "file upload". Therefore I have a number of questions, you may have an answer or can provide me a link for some of these.

Questions

How to add a new type for an EAV attribute?
How to add the handling of the field so it gets recognized and rendered as file upload?
How to setup the persistency handling for this new "type"?

Thank you in advance


texts: Magento DB Collection generate error on UNION

texts:
I've try to resolve this issue many hours but end up with no luck.

Here is the senario:

I have a store locator and have 2 types of dealers. Master and General. I need to list Master dealer first  and General Dealers 2nd. Best solution is to use UNION in collection

        $cloneSelect = clone( $collection1->getSelect() );
        $collection1->getSelect()->reset()->union(
            array(
                 "( ". $cloneSelect ." )",
                 "( ". $collection2->getSelect() ." )",
             ) );

When I view $collection->getSelect()->__toString() this generate ( $collection1 ) UNION  ( $collectio2 )

but when I apply $collection1->getSize() or any method it generate following error.

  No table has been specified for the FROM clause

I know it generate this error becouse $collection need to have from clause, If that's the case dose anyone have IDEA how to do union and get collection

Thanks


texts: WYSIWYG Editor Insert Image Browse Button not Showing on frontend

texts:
I have a problem with insert image popup. The popup opens, but I can't see the browse button so I can't upload an image from frontend.
What can be the problem?

On phtml i have used below jquery to open tinymce popup.

require([
    'jquery',
    'mage/adminhtml/wysiwyg/tiny_mce/setup'
], function (jQuery) {

    var config = {},
            editor;
    jQuery.extend(config, {
        settings: {
            theme: 'advanced',
            theme_advanced_buttons1: 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
                    'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
            theme_advanced_buttons2: null,
            theme_advanced_buttons3: null,
            theme_advanced_buttons4: null
        }
    });
    editor = new tinyMceWysiwygSetup(
            'short_description',
            config
            );
    editor.turnOn();
    jQuery('#short_description')
            .addClass('wysiwyg-editor')
            .data(
                    'wysiwygEditor',
                    editor
                    );
});


texts: Magento 2 EE | How to create/update new record in magento_customerbalance_history table?

texts:
I am trying it as:

Using the collection

  \Magento\CustomerBalance\Model\Balance\HistoryFactory $historyFactory

As

$model = $this->_historyFactory->create();
    //$model->setId(2);
    $model->setData('balance_amount', 333);
    $model->save();

But it prompts this exception:

  1 exception(s): Exception #0
  (Magento\Framework\Exception\LocalizedException): A balance is needed
  to save a balance history.


texts: Magento 2.2.5 - Uncaught TypeError: Cannot read property 'dialog' of undefined

texts:
Installed Magento 2.2.5 with sample data, everything works fine. Added a new theme Ves Need theme, got the below issues on the home page console.

  Uncaught TypeError: Cannot read property 'dialog' of undefined
  Uncaught TypeError: Cannot read property 'timepicker' of undefined

Due to this, the subcategory dropdown on the nav bar not working.

Kindly help us to fix this.


texts: How to see simple products of configurable from admin panel

texts: How can I see the Associated products of a configurable product? In magento 1 there is a tab on the bottom called Associated products. Where is it present in magento 2? Also, how can I create a configuration of a configurable product after I have created it?


texts: Magento how to Google Analytics enhanced eCommerce Tracking

texts:
I am new to the Google Analytics world and would like to implement Google Analytics enhanced eCommerce Tracking on my magento 1.9.3.2 site. I am a little confused how to best set this up:

How would I set these "funnel steps" up for my magento site?

Also, I have set-up the following goal:

Would this be correct?

Update:

Looking at the funnel below for the goal you can see various drop-outs to other checkout pages and from place order clicked to exit 18 times! this seems odd.


texts: Magento2 How to get baseurl in html file

texts: Magneto2 How can I get baseUrl in HTML(shipping.html) file? I need to add cart page URL in one step checkout.


texts: Image Uploader throws Uncaught type Error in Ui Component

texts:
I'm Using UI component to upload an image but it throws this error

  Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Framework\View\Element\UiComponentFactory::argumentsResolver() must be of the type array, null given, called in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php on line 220 and defined in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php:172 Stack trace: #0 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php(220): Magento\Framework\View\Element\UiComponentFactory->argumentsResolver('banner', NULL) #1 C:\xampp\htdocs\Magento\vendor\magento\module-ui\Component\Form\Field.php(84): Magento\Framework\View\Element\UiComponentFactory->create('banner', 'imageUploader', Array) #2 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Layout\Generator\UiComponent.php(159): Magento\Ui\Component\Form\Field->prepare() #3 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Layout\Generator\UiComponent.php(156): Magento\Framework\View\Layout\Generator\UiComponent->prepareC in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php on line 172

My Code for Image Uploader is

        <field name="banner">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">flashsalespro</item>
                <item name="dataScope" xsi:type="string">banner</item>
                <item name="label" xsi:type="string" translate="true">Upload Banner</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="sortOrder" xsi:type="number">150</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">PME_FlashSalesPro/image-preview</item>
                <item name="required" xsi:type="boolean">false</item>
                <item name="notice" xsi:type="string" translate="true">Upload image for sales background.</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="sales/index/upload"/>
                </item>
            </item>
        </argument>
    </field>


texts: I am working on script and want to know about how magento credit memo created. My requirement is same as magento after update quantities of product in order, hit update order button. Then enter custom shipping , custom Adjustment Refund , custom Adjustment Fee. How this work programatically.


texts:
I want to get customer id in block but the customer session returns null.
from controller, i could get customer id.
logger in block works well so the customer id is executed.
vendor/Block/Config.php
class Config extends \Magento\Framework\View\Element\Template
{
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Customer\Model\Session $customerSession
    ) {
        $this->session = $customerSession;
        $this->logger = $logger;

        parent::__construct($context);
    }

    /**
     */
    public function getCustomerId(): int
    {
        $this->logger->debug('this log is ok');
        return $this->session->getCustomer()->getId(); // return null
    }

from view,
<?=$block->getCustomerId();?>
this code returns 500 because the type hinting of getCustomerId() is :int and return null.
this->session->getCustomer returns null
this->session->isLoggedIn also returns null
i saw almost same, other question in stackexchange, they do not fit my ploblem.
like this Magento2 error on injecting customer session in block
ofcourse i did
setup:upgrade
setup:di:compile
cache:celan


texts:
I have created a module in magento2 to upload image field. Saving the
  image hiding the image upload field option in backend

public function execute()
    {
        /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();
        $data = $this->getRequest()->getPostValue();
        if($data) {
            if(isset($data['is_active']) && $data['is_active'] === 'true') {
                $data['is_active'] = Notification::STATUS_ENABLED;
            }
            if(empty($data['notification_id'])){
                $data['notification_id'] = null;

            }

            if(isset($data['image']) && is_array($data['image'])){
                $data['image']=$data['image'][0]['name'];
            }
            else{
                $data['image'] = null;
            }
            /** @var  \Dzinehub\PushNotification\Model\Notification $notification */
            $model = $this->notificationFactory->create();

            $id = $this->getRequest()->getParam('notification_id');

            if($id) {
                try{
                    $model = $this->notificationRepository->getById($id);
                } catch(LocalizedException $e) {
                    $this->messageManager->addErrorMessage(__('Notification no longer exists'));
                    return $resultRedirect->setPath('*/*/');
                }
            }
             $model->setData($data);

            /* var_dump($data);
             die;*/

              try {
                $this->notificationRepository->save($model);
                $this->messageManager->addSuccessMessage(__('You saved the notification.'));
                $this->dataPersistor->clear('dzpushnotif');
                if ($this->getRequest()->getParam('back')) {
                    return $resultRedirect->setPath('*/*/edit', ['notification_id' => $model->getId()]);
                }
                return $resultRedirect->setPath('*/*/');
            } catch (LocalizedException $e) {
                $this->messageManager->addErrorMessage($e->getMessage());
            } catch (\Exception $e) {
                $this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the notification.'));
            }

            $this->dataPersistor->set('dzpushnotif', $data);
            return $resultRedirect->setPath('*/*/edit', ['notification_id' => $this->getRequest()->getParam('notification_id')]);
        }
        return $resultRedirect->setPath('*/*/');
        }

  Also, how to move the image from temporary directory using this
  function moveFileFromTmp. Any help on this issue?


texts: Why merging CSS generates 2 or more file, not a single file?

texts:
when i enable

  Merge CSS Files -> Yes

magento generates 3 css files , why it can't generate as a single css file

is there any way to achieve this?


texts: Magento 2 - How to get new and best sellers products data using product graphql?

texts:
I want new products and bestsellers product data in product graphql. and also product review and rating.
Does anyone have an idea?


texts:
I have included a Static Block called "home-center-contact" for 4 different Store Views with the ID's '14', '19', '16' and '18'.

Why am I seeing the number on my homepage along with the Static Block? Including the default Store View, which I am NOT including "home-center-contact" on?

Here is the code I have added to "home.phtml":

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-promotion')->toHtml(); ?>
<?php echo $storeId = Mage::app()->getStore()->getStoreId();
 if($storeId == '14')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '19')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '16')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
}
if($storeId == '18')
{ $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
} ?>

Store Views with "home-center-contact":

https://beaconbingo.kellyseye.com/

https://cashino.kellyseye.com/

https://tanexpress.kellyseye.com/

https://merkurengineering.kellyseye.com/

Store View NOT Including "home-center-contact" but including "home-center-promotion":

https://store.kellyseye.com/

Can anyone help?