texts: How to get product collection based on custom price attribute in Magento 2?

texts:
I am using Magento 2.2.2

I have created one attribute "Retail Price". Input type for this attribute is "Price". I have added values in some products for this attribute. Now I want to load product collection based on "Retail Price" range. I have tried using the following code:

$collection = $productCollection->addAttributeToSelect('*')
                ->addAttributeToFilter('status', 1)
                ->addAttributeToFilter('retail_price' , array('from' => 501, 'to' => 700));
$collection->load();

After using the above code I didn't get any products in the result. So, what can be the issue in the above code?


texts: How can I bootstrap Magento 2 in a test.php script?

texts:
In magento 1 I could create a file where I only needed to instantiate the Mage_Core_Model_App class and then I could add my "dirty" code for test purposes.
Something like this test.php:

<?php
//some settings
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
//instantiate the app model
Mage::app();
//my toy code in here.

Then I was able to call test.php in the browser and see what I'm doing.

How can I do the same for Magento 2?


texts: Magento 2: How to Enable Layered Navigation?

texts:
I've successfully implemented the layered navigation in Magento 1x but I can't seem to get it to work in Magento 2x.

There's a good guide that can be found here: www.magestore.com/magento-2-tutorial/magento-2-how-to-enable-layered-navigation

But following it, I just couldn't get it to work.

The categories and sub categories as attributes are just not showing up in the left sidebar.

Anyone?

Thanks :)


texts: Magento2: Not able to assign Source after enable the MSI module

texts:
I have disabled the MSI inventory module (as explained in this article) in my store. After facing some issues I have reverted back MSI related all modules, but after enabled all modules I am not able to assign Source in Manage stock.

Can Any one help me to fix this issue, because MSI is very complicated to debug the issue.


texts:
I have been through all of the standard things for speeding up magento 1.8:

Compressed and combined stylesheets and javascripts.
 Enabled magento compiler.
emptied log tables in db.
Disabled logging.

Installed APC as an opcode cache using recommended settings
 Enabled caching and compression in apache.

Am using Argento theme.

What else can I do?

Was looking at varnish and redis but not sure if these are appropariate for a site with small catalogue and seems like there must be other simpler things I can do.

How can I debug where the problem is, page speed insights says slow server response and I get only 52 on the page speed insights score.

Any help on how to debug this gratefully received.

Paul

UPDATE:
Testing page speed insights over time it seems there is a high variability over weeks as to what score is achieved. I'm wondering if that means it is down to the server rather than magento site alone. Anyone?


texts: Is there a way to declare preference for a model or overwrite a model alias in M1?

texts:
I'm using Magento 1.9.x EE.

I'm looking to overwrite the Mage_Core_Model_Email_Template::send function.

I could overwrite the core class, but then my changes would be dependent on code that resides outside of the new custom module for my feature and IMO this is bad practice.

I understand Magento 1.x is outdated at this point and doesn't have all the features of Magento 2 but I would like to know if this is possible.

In Magento 2 I could do something like this:

<!--  File: app/etc/di.xml -->
<config>
    <preference for="Magento\Core\Model\UrlInterface" type="Magento\Core\Model\Url" />
</config>

Is this feature possibly to duplicate at all in Magento 1.9.x?


texts: How to get product Frontend URL in Admin in Magento 1.9?

texts:
I am using below code to get Product frontend URL in admin but it's throwing 404 error.

$product = Mage::getModel('catalog/product')->load($productId);
$product->getProductUrl()

Can anyone tell me how to get product frontend URL in admin. I want to get rewrite URL so that if I click on link then it will redirect to  product view page in frontend.


texts: Magento2 : Not able to Log Order Details when order is Placed

texts:
I am trying to print order details in Log /return JSON result when a new order is placed. Nothing is printing in System.log or in exception.log,

Please check my code below, Let me know where I am doing wrong.

  \app\code\Autosynch\Sale\registration.php

<?php /**
* Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Autosynch_Sale',
__DIR__
);

  \app\code\Autosynch\Sale\etc\module.xml

<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Autosynch_Sale" setup_version="0.0.1">
    </module>
</config>

  \app\code\Autosynch\Sale\etc\event.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_submit_all_after">
        <observer name="modulename_sales_order_place_after" instance="Autosynch\Sale\Observer\OrderPlaceAfter" />
    </event>
</config>

  \app\code\Autosynch\Sale\Observer\OrderPlaceAfter.php

<?php
   namespace Autosynch\Sale\Observer;

    use Magento\Framework\Event\ObserverInterface;
    use Magento\Framework\Event\Observer;

    class OrderPlaceAfter implements ObserverInterface
    {
        protected $_logger;

        /**
         * @param \Psr\Log\LoggerInterface $_logger
         */

        public function __construct(
            \Psr\Log\LoggerInterface $_logger
        ){
            $this->_logger = $_logger;
        }

        public function execute(Observer $observer)
        {
            $order = $observer->getEvent()->getOrder();

            $this->_logger->info($order->getData());
            $this->_logger->debug($order->getData());

            //var_dump($order->getData());
            //exit;
        }
    }


texts:
Following are my tax settings.

User belongs to Customer Group "EU-B2B VAT Free" but it is still getting charged 20% tax, whereas it should be charged 0% tax. I am not sure where the configuration is wrong or if there is any other issue.
It will be helpful, if any one can guide towards right to resolve this issue.


texts: Magento 2 : System Configuration in main website not showing

texts: In store different it showing but when i change to main website it not showing


texts: Can you sell product (fabric) by the metre in Magento?

texts:
We have fabric on a roll which we cut to requirement. Let's call this main product 'Red Fabric'. We have 100 (metres) in stock.

We want a dropdown showing customers length options they can buy; 2m, 3m, 4m etc. We do not however want to set these up as having there own stock levels as stock is same as parent product.

When purchased, a 2m would reduce stock of main product by 2, a 3m purchased would reduce stock by 3 etc.

We cannot just use a simple product and use product quantities as we want to see the order as:

1 of the 3m 'Red Fabric'

and

1 of the 5m 'Red Fabric'


texts:
we have a website that is running on Magento 2. This site has been enabled to show out of stock products. Below each out of stock product it displays 'out of stock' how can i change the wording of this to say 'currently out of stock'.

Thanks


texts: Why magento 2 has controller file for each action?

texts:
Magento 2 controller file created for each action like add,edit, delete, update, get.
I want to know about the advantage of creation controllers for each action.


texts: how can i get the the attribute label from the attribute value in magento 2?

texts:
I got the attribute value 232 from the below code

    $_product->getData('farben');

How I get its label from this value?


texts:
I am setting up a Magento store and it has a lot of CMS content.

I have been fiddling between:

Creating categories and actual CMS page with corresponding URL then rewrite the categories url to the CMS Page
Creating categories and and static blocks (with CMS content) and just link the categories to the right static block.

It seems to me the latter solution is less of a hassle and cleaner, but is there any con in doing this ?


texts: 2 contact us forms with different email configuration

texts:
I want to copy magento "contact us" form, however, set a different configuration to it.

Now, "contact us" form sends information to support@company.com.
I want "contact us 2" to be exactly the same as "contact us" but send information to sales@company.com.

I want 2 different contact forms on the site, and each sends information to different email address.

How can I do this?


texts:
On our Magento 2 store we have a second sitemap we need to remove. Can someone advise how we do this please?

Many thanks


texts:
I have an issue with my javascript/PHP files.

If I open example.com/js/index.php

Then instead of the normal output it opens the file with all the content rather then executing it.

Does anybody know what the issue could be?

Other .php files get executed normally


texts: Cannot customize header block by custom module

texts:
First, I can easily change header template by

<reference name="header">
      <action method="setTemplate"><template>customizer/header.phtml</template></action>
</reference>

But, I want to add some functions to header block, so I try to extend:

class My_Customizer_Block_Header  extends Mage_Page_Block_Html_Header

So I change my custom layout xml to

<reference name="header">
      <block type="customizer/header" name="header" as="header" template="customizer/header.phtml" />
</reference>

Now, $this->getTemplate() returns null, ($this->hasData('template') returns null as well)

Even if I change xml to

<reference name="header">
      <block type="customizer/header" name="header" as="header">
             <action method="setTemplate"><template>customizer/header.phtml</template></action>
      </block>
</reference>

it still doesn't work.

I also try to extend Mage_Core_Block_Template but it doesn't work.

I don't know why I cannot set custom template for header by custom module.
Someone asked here but the answer is not clear enough to me.

Note:

I don't want to copy Mage/Page/Block/Html/Header.php to local directory.
I don't want to rewite completely header class by config.xml, just change header in my custom handle

Thank you.

UPDATE:

For clearer,

I'm using a custom theme base on rwd package (1.9.0.1)
My needed is:

All pages still use default header of custome theme (rwd/mytheme/page/html/header.phtml)
Custom header for ONLY custom handle (eg: domain.com/customizer)
I nead to use completely different header for my custom handle, that's why I try to reuse header name. (I also intent to remove each default header child, then add my custom child for header, but I think it's not best way)


texts: How to i'll tax calculate in Magento 2. My tax prices is already added in catalog products prices. I just want to show 5% Vat tax on subtotal but don't want to add in Subtotal and Grand Total. Please help me regarding this issue. Thanks in advance. Please check below screenshot what's showing right now. subtotal and tax is showeing is ok but adding in Total.


texts: Accessing variables from another require JS module

texts:
Cannot understand how to organize JS/PHTML cross vars and functions calling for Magento 2 using Require.js.
The standard methods are not working. Made a lot of tries, but no success. Hope somebody help me.

Task: get the var value and call function in JS file from the script located in PHTML template

We have: requirejs-config.js, modu.js, ask.phtml

Code:

requirejs-config.js

var config = {
    map: {
        "*": {
            modu: "js/modu",
        }
    },
    deps: [
        "js/modu",
    ],
    paths: {
        modu: "js/modu",
    },
};

modu.js

define([
    "jquery",
    "domReady!"
], function($) {
    "use strict";

    var moduVar = 'ModuVar test var';

    function fromPhtml(x) {
        console.log(x);
    }

});

ask.phtml

<script>

require([
        'jquery',
        'modu',
        'domReady!'
    ], function($, modu) {

    console.log(modu.moduVar);

    modu.fromPhtml("This is output from ask.phtml");

});

</script>

Something like this.


texts: External (CDN) location images only for multiple domain stores

texts:
I have multiple stores on multiple domains (all single store magento installs) that use a lot of the same product images. I want to store all the images in a single location and let the different stores (on different domains) fetch the images from that location.

I can redirect all media by using "Secure Base URL for User Media Files" which works, but I want only the product images to be shared and not all media.

I also don't know how this works regarding the "cache/" subfolder since magento looks for that folder.

Any tips how I can get this working? This would save me a huge amount of server disk space on the individual stores.


texts: I've created a store view (different language) but I receive "There was no 404 CMS page configured or found." when changing language

texts:
I have a store with 3 different languages (EN,DE & FR) and I have installed the language packs for those and I can verify the installation is correct as "app/" has appeared on the file system.

I have then created a store view for each of those languages but 'FR' gives the error "There was no 404 CMS page configured or found." when changing language while viewing a product and I also get that error on both 'FR' and 'DE' when looking at the stores front page.

Have I missed a configuration option somewhere?

Stephen,


texts: What's the use and impacts of calendar.js in mage 1.9.x

texts:
We are using CE 1.9.2.2 currently and I am desperate to get rid of the calendar.js-es and .css-es in my layout file. I'm not sure what they are used for but all I see is a large bloat of unnecessary inline-scripting and JS and CSS loading.

But as soon as I comment out one of the following lines in my (custom) catalog.xml, the whole product single view breaks and fall back to an undefined layout-file (somehow a CSS newsfeed is shown in the sidebar).

[...]
<catalog_product_view translate="label">
[...]
  <reference name="head">
    <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/>
    <action method="addItem"><type>js</type><name>calendar/calendar.js</name>
    <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name>
  </reference>
[...]
  <reference name="content">
    <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
      [...]
      <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
      </block>
      [...]
    </block>
  </reference>
</catalog_product_view>

So far I cannot tell what these three files do and where we would need them. But I can't throw them out either. Why is commenting out the JS and CSS as well as the html_calendar-block destroying the overall layout for <catalog_product_view>? Even more: the catalog_category pages only show the (correctly populated) layred navigation, but not products...


texts: Geting the available quantity for all products via REST API

texts: How can I get the available quantity for all products via REST API?. Do I have to create a new module for this? What is the most efficient way to achieve this?


texts: Shipping cost only if order subtotal less than specific amount else free shipping for everyone including guest.

texts:
How to set shipping cost if cart subtotal is less than specific amount else free shipping?

This is applicable for all members even for not logged in users.


texts: Magento 2: Extension Validation error for marketplace

texts:
marketplace,  I am validating my extension but i have two extentions in one directory

Here is Zip directory structure is:

Module Zip folder

   ABC.zip
   module1
   module2

getting error:

  More than one top-level directory detected, number of directories =
  2. Top level directory expected to be the module directory.

Can you please provide the solution for this?

Thanks


texts:
I would like to reindex a single product after an update.

Now I use:

$product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'foobar');
// edit something
$product->save();

$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
$stockItem->setForceReindexRequired(true);

Mage::getSingleton('index/indexer')->processEntityAction(
    $stockItem,
    Mage_CatalogInventory_Model_Stock_Item::ENTITY,
    Mage_Index_Model_Event::TYPE_SAVE
);

$product
    ->setForceReindexRequired(true)
    ->setIsChangedCategories(true);

Mage::getSingleton('index/indexer')->processEntityAction(
    $product,
    Mage_Catalog_Model_Product::ENTITY,
    Mage_Index_Model_Event::TYPE_SAVE
);

But this doesn't work, any ideas?

PS:
$product->getId() is existing and correct.


texts: Patch 9767 can't be applied/reverted successfully in Magento 1.9.3.1

texts:
I installed few patches in Magento 1.9.3.1. I tried to installed Patch SUPEE-9767 v2 from sh and manually as well. I am getting "patch can't be applied/reverted successfully" as error message. I have described all error messages in following image . Could anyone give possible solution for it?

I didn't find any answer from same Questions so i put this question for magento 1.9.3.1
Thank You


texts: Magento 2 items orders and invoice not show in customer account orders list

texts:
Hello Guys Please help me

Magento ver. 2.3.0

Date 2/20/20 place orders display only, not display 2019 orders in live site

I checked it is working right on local server

I run all these commands but nothing happened

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

php bin/magento indexer:reindex

php bin/magento cache:flush

  [2020-03-05 08:17:09] main.CRITICAL: Warning: Illegal string offset
  'info_buyRequest' in
  /var/www/vhosts/xyz.com/httpdocs/vendor/magento/module-sales/Model/Order/Item.php
  on line 481 [] []


texts: Magento2: How to add simple product in configurable product dropdown

texts:
How to add the simple product in a configurable product? And How to redirect parent product in a Configurable product.

Magento 2.0


texts:
I have this code:

 $link = $this->getLayout()->createBlock('core/text_tag')
        ->setTagName('a')
        ->setTagParams(array(
            'href'  => '#',
            'class' => 'link',
        ))
        ->setTagContents($text)
   ;

that creates a link

how do I create a span element inside this type?


texts: Can you explain the interest line: Shopify vs. Magento on Google Trends?

texts:
If we check Google Trends and compare "Shopify" and "Magento" terms by filtering only "United States", we will see that interest live for Shopify will overpower Magento very soon. What do you think are the main reasons?

Thank you!


texts:
I am not able to override this file vendor/magento/module-sales-rule/Model/Rule/Condition/Address.php using preference.

<preference for="Companyname\Subtotalwithdiscount\Model\Rule\Condition\Address" type="Magento\SalesRule\Model\Rule\Condition\Address" />

Can someone guide me on this?


texts: Magento 1.9 CE - Enable HTML links in error/custom messages

texts:
I would like to know if this is possible to enable HTML links in custom messages (ie: error messages).

Here is my example: I've made an override for my needs of Mage_CatalogInventory_Model_Stock_Item/Item.php

Function checkQuoteItemQty :

if (!$this->checkQty($summaryQty) || !$this->checkQty($qty)) {
     //$message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $this->getProductName());
     $message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available (max:%s).', $this->getProductName(), ($this->getQty() * 1));
     $cat_id = $this->getProduct()->getCategoryIds();
     if($cat_id){
         $url = Mage::getModel('catalog/category')->load($cat_id[0])->getUrl();
         $message .= Mage::helper('cataloginventory')->__('You might be interested in those products.', $url);
      }
      $result->setHasError(true)
           ->setMessage($message)
           ->setQuoteMessage($message)
           ->setQuoteMessageIndex('qty');
     return $result;
}

But the HTML link I created in $message :
($message .= Mage::helper('cataloginventory')->__('You might be interested in those products.', $url);)
is not clickable and considered as text (because of the translation I guess...). Is it possible to change this behavior?

Regards.


texts:
We imported a list of customers, which contained cleartext passwords from an old database (yes, believe me I understand how terrible it is to think they were stored as cleartext).

After the users have logged in at least once, then the Magento CE 1.9 reset system works like a charm. Also it works fine for new accounts that are created online, or in the admin.

The problem only exists for those that were imported, but have never logged in since the migration to Magento. After they click "Forgot your password" from the Magento Login page, they are asked to enter their email, and after they do, they receive an email with a link to go reset the password.

However, after they enter and confirm their new password, the system tells them that the link they used has already expired.  This should not be the case, because I have the link expiry set to a full day, but the error occurs even when completing the process in less than 10 minutes.

Is it a password hash/salt problem?  I assume so, since it works for imported users that had previously signed in (therefore correctly encrypting their passwords).


texts:
After installing magento 2 via command line i get 403 Forbidden error trying to run setup.

I changed file permissions like this:

find . -type f -exec chmod 644 {} \;

 find . -type d -exec chmod 755 {} \;

find ./var -type d -exec chmod 777 {} \;

find ./pub/media -type d -exec chmod 777 {} \;

find ./pub/static -type d -exec chmod 777 {} \;

chmod 777 ./app/etc

chmod 644 ./app/etc/*.xml

chmod u+x bin/magento

Still have issues. I've checked online to see if 403 has anything to do with anything but file permissions and this is all i'm getting to.


texts:
I am currently working on an architecture where I'd like to maintain separate caches (block cache, collection cache, FPC) for each zipcode. I am making the user select a zipcode at the beginning of the journey, and I wrote plugins/observers for modifying various parts of Magento altogether (like fetching product price, which is different for each zipcode).

Everything seems to be working fine when I have cache disabled. But as I enable the cache, the data is cached for the first user and his/her zipcode, and it shows the same data to all users.

Now what I want is to maintain separate cache copies for each zipcode. I know that Magento keeps a separate cache copy for each store view. I did a lot of digging but couldn't find how Magento manages to do it. If someone could guide me to the classes/function which are responsible for the "store-view-based caching", then I could probably write plugins for those functions to maintain a zipcode based caching system.


texts: Does anyone have any idea about shipping Dry Ice with FedEx in Magento 2. How to configure it in Magento 2 application


texts: How to translate b2b roles and permissions?

texts:
I have a what should be a simple task of translating the roles and permissions control page in b2b but I just cant make it work

I know that the texts are from this file

vendor/magento/module-company/etc/company_acl.xml

<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Company::index" title="All" translate="title" sortOrder="100">
                <resource id="Magento_Company::view" title="Company Profile" translate="title" sortOrder="100">
                    <resource id="Magento_Company::view_account" title="Account Information (View)" translate="title" sortOrder="100">
                        <resource id="Magento_Company::edit_account" title="Edit" translate="title" sortOrder="100" />
                    </resource>
                    <resource id="Magento_Company::view_address" title="Legal Address (View)" translate="title" sortOrder="200">
                        <resource id="Magento_Company::edit_address" title="Edit" translate="title" sortOrder="200" />
                    </resource>
                    <resource id="Magento_Company::contacts" title="Contacts (View)" translate="title" sortOrder="300" />
                </resource>
                <resource id="Magento_Company::user_management" title="Company User Management" translate="title" sortOrder="200">
                    <resource id="Magento_Company::roles_view" title="View roles and permissions" translate="title" sortOrder="100">
                        <resource id="Magento_Company::roles_edit" title="Manage roles and permissions" translate="title" sortOrder="200" />
                    </resource>
                    <resource id="Magento_Company::users_view" title="View users and teams" translate="title" sortOrder="300">
                        <resource id="Magento_Company::users_edit" title="Manage users and teams" translate="title" sortOrder="400" />
                    </resource>
                </resource>
                <resource id="Magento_Sales::all" title="Sales" translate="title" sortOrder="10">
                    <resource id="Magento_Sales::place_order" title="Checkout (place order)" translate="title" sortOrder="20">
                        <resource id="Magento_Sales::payment_account" title="Use Pay On Account method" translate="title" sortOrder="30" />
                    </resource>
                    <resource id="Magento_Sales::view_orders" title="View orders" translate="title" sortOrder="40">
                        <resource id="Magento_Sales::view_orders_sub" title="View orders of subordinate users" translate="title" sortOrder="40" />
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

what I found on the internet but sadly none helped:

In Magento 2, what does `translate="true"` really do in XML?

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/translations/translate_theory.html

How to translate title attribute in acl.xml

What I tried after making a working i18n translation file:

1- change the translate attribute to true

2- change the translate attribute to the string i want to translate

Any advice would be appreciated
Thanks in advance


texts: How to add CSS DIV class to CMS static block? Magento2

texts:
So I made 3 CMS Static Blocks, which are my footer links.

How can I add a CSS div class to each CMS static block so I can actually put these footer link blocks SIDE BY SIDE?

Would be amazing if someone could help me out! Im stuck with this problem for a few weeks already and didnt find any solution...


texts: How to call controller action from helper?

texts:
Is it possible to call my controller action from a helper?

I have a controller action in app\code\local\Fekete\Newsletter2Go\controllers\IndexController.php

public function apiAction()
{
    echo "hello";

}

This is a snippet of my helper app\code\local\Fekete\Newsletter2Go\Helper\Data.php. I try to call the controller action apiAction().

public function getIsSubscribedAtNewsletter2Go($email)
{
    $url = '/fekete_newsletter2go/index/api';

    $data = array(
        'email' => $email,
    );

    // use key 'http' even if you send the request to https://...
    $options = array(
        'http' => array(
            'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
            'method'  => 'POST',
            'content' => http_build_query($data)
        )
    );

    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    if ($result === FALSE) { return "fail!"; }

    return "success";

}

But this always returns "fail!".

What am I missing?


texts: Magento 2: change product page layout from admin

texts:
I am working on a Magento 2.1.7 shop and  I have created a child-theme of Magento Blank.

I've changed the layout of my homepage to 2 columns with left bar from Content -> Pages. I need to do the same for the product page.

As can be seen in the image below, I don't have this option for the product page:

Can I enable changing this layout from Content -> Pages? If not is there an alternative (best way) to get the same result?

Thank you!


texts: Magento 2 How can i create model factory for custom module?

texts:
Hi i am trying to collect some data from the database but the create method of the injected factory fails and no errors are showed.
Here are my classes.

magento\app\code\Cosmo\Basemodule\Model\DatiInterface.php

<?php
namespace Cosmo\Basemodule\Model;
interface DatiInterface
{

}

magento\app\code\Cosmo\Basemodule\Model\Dati.php

namespace Cosmo\Basemodule\Model;

use Magento\Framework\Model\AbstractModel;
use Magento\Framework\DataObject\IdentityInterface;
class Dati extends AbstractModel implements DatiInterface, IdentityInterface
{
    protected function _construct()
    {
        $this->_init('Cosmo\Basemodule\Model\ResourceModel\Dati');
    }

    public function getIdentities()
    {
       //todo
    }
}

magento\app\code\Cosmo\Basemodule\Model\ResourceModel\Dati.php

<?php
namespace Cosmo\Basemodule\Model\ResourceModel;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;

class News extends AbstractDb
{
    /**
     * Define main table
     */
    protected function _construct()
    {
        $this->_init('exampletable', 'entity_id');
    }
}

magento\app\code\Cosmo\Basemodule\Model\ResourceModel\Dati\Collection.php

<?php
namespace Cosmo\Basemodule\Model\ResourceModel\Dati;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;

class Collection extends AbstractCollection
{
    /**
     * Define model & resource model
     */
    protected function _construct()
    {
        $this->_init(
            'Cosmo\Basemodule\Model\Dati',
            'Cosmo\Basemodule\Model\ResourceModel\Dati'
        );
    }
}

And then block where i inject the factory
magento\app\code\Cosmo\Basemodule\Block\Main.php

 <?php
 namespace Cosmo\Basemodule\Block;

 use Magento\Framework\View\Element\Template\Context;
 use Cosmo\Basemodule\Model\DatiFactory;

 class Main extends \Magento\Framework\View\Element\Template
 {
    protected $_datiFactory;

    public  function __construct(Context $context, DatiFactory $datiFactory)
    {
        parent::__construct($context);
        $this->_datiFactory = $datiFactory;
    }

    public function _prepareLayout()
    {
        echo 'pippo<br \>';
        $dati = $this->_datiFactory->create();
        var_dump($dati->getCollection());
        exit();
    }
}

I tried in many ways but create() fails and then nothing is executed.


texts: Magento2: Cron is not working. All status are pending in database

texts:
I have set the cron on my server. In cron log file message update successfully "Ran jobs by schedule". But in the database, all cron is showing status pending.

*/1 * * * * /usr/bin/php /var/www/html/magento_main/bin/magento cron:run  >> /var/www/html/magento_main/var/log/magento.cron.log


texts: How to remove custom customer attribute in magento 2.3

texts:
I want to remove custom customer attribute in magento 2 but it's not working. I tried below code but not working for me. Can you help?

<?php
 namespace Vendor\Module\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;

class InstallData implements InstallDataInterface
 {
 private $eavSetupFactory;

public function __construct(EavSetupFactory $eavSetupFactory) {
 $this->eavSetupFactory = $eavSetupFactory;
 }

 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context){
 $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
 $eavSetup->removeAttribute(
 \Magento\Customer\Model\Customer::ENTITY,
 'hello_world');
 }
 }


texts: magento sites all in a sudden showing blank frontend and backend

texts:
we have 3 magento sites in a single server

www.site1.com , demo.site1.com, site2.com

our all 3 magento sites were working fine.

all in a sudden site1.com site's frontend and back end showed blank.

now demo.site1 site's frontend showing blank and admin panel working fine.

site2.com is working fine for both frontend and backend.

why these sites are showing blank in frontend and backend.

we are using amazon server. only 60 % space is used.

please help me to find solution.

thanks in advnace.


texts:
Magento 2 Image not saving in Database. My custom field is img

public function execute()
    {
        $data = $this->getRequest()->getPostValue();

        /*print_r($data);exit();*/
        /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();
        if ($data) {
            $model = $this->_objectManager->create('Urds\OfferBanner\Model\Banner');

            $id = $this->getRequest()->getParam('offerbanner_id');
            if ($id) {
                $model->load($id);
                $model->setCreatedAt(date('Y-m-d H:i:s'));
            }
            try{
                $uploader = $this->_objectManager->create(
                    'Magento\MediaStorage\Model\File\Uploader',
                    ['fileId' => 'image']
                );
                $uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']);
                /** @var \Magento\Framework\Image\Adapter\AdapterInterface $imageAdapter */
                $imageAdapter = $this->_objectManager->get('Magento\Framework\Image\AdapterFactory')->create();
                $uploader->setAllowRenameFiles(true);
                $uploader->setFilesDispersion(true);
                /** @var \Magento\Framework\Filesystem\Directory\Read $mediaDirectory */
                $mediaDirectory = $this->_objectManager->get('Magento\Framework\Filesystem')
                    ->getDirectoryRead(DirectoryList::MEDIA);
                $result = $uploader->save($mediaDirectory->getAbsolutePath('emizen_banner'));
                    if($result['error']==0)
                    {
                        $data['image'] = 'emizen_banner' . $result['file'];
                    }
            } catch (\Exception $e) {
                //unset($data['image']);
            }
            //var_dump($data);die;
            if(isset($data['image']['delete']) && $data['image']['delete'] == '1')
                $data['image'] = '';

            $model->setData($data);

            try {
                $model->save();
                $this->messageManager->addSuccess(__('The Banner has been saved.'));
                $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false);
                if ($this->getRequest()->getParam('back')) {
                    return $resultRedirect->setPath('*/*/edit', ['offerbanner_id' => $model->getId(), '_current' => true]);
                }
                return $resultRedirect->setPath('*/*/');
            } catch (\Magento\Framework\Exception\LocalizedException $e) {
                $this->messageManager->addError($e->getMessage());
            } catch (\RuntimeException $e) {
                $this->messageManager->addError($e->getMessage());
            } catch (\Exception $e) {
                $this->messageManager->addException($e, __('Something went wrong while saving the Banner.'));
            }

            $this->_getSession()->setFormData($data);
            return $resultRedirect->setPath('*/*/edit', ['offerbanner_id' => $this->getRequest()->getParam('offerbanner_id')]);
        }
        return $resultRedirect->setPath('*/*/');
    }


texts:
Just a little problem which isn't blocking anything but still anoying.

I have created 2 modules triggered through a cron task. In both case, the module works fine, the cron tasks are scheduled correctly and the method called is executed. The problem is, if I look in the database (table cron_schedule), I can see that the scheduled_at and executed_at columns are set with dates, but the finished_at column is never filled. The cron task then ends in error because it reaches the time to live.

Any idea why it does that ?

Here's some code:

app/code/local/MyPackage/MyModule/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <MyPackage_MyModule>
            <version>1.0</version>
        </MyPackage_MyModule>
    </modules>

    <global>
        <blocks>
            <myModule>
                <class>MyPackage_MyModule_Block</class>
            </myModule>
        </blocks>

        <helpers>
            <myModule>
                <class>MyPackage_MyModule_Helper</class>
            </myModule>
        </helpers>

        <models>
            <myModule>
                <class>MyPackage_MyModule_Model</class>
            </myModule>
        </models>
    </global>

    <crontab>
        <jobs>
            <myPackage_myModule>
                <schedule><cron_expr>0 9 * * *</cron_expr></schedule>
                <run><model>myModule/observer::processReport</model></run>
            </myPackage_myModule>
        </jobs>
    </crontab>

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <MyPackage_MyModule after="Mage_Adminhtml">MyPackage_MyModule_Adminhtml</MyPackage_MyModule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

    <adminhtml>
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <myModule>
                                            <title>orders report</title>
                                        </myModule>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>
    </adminhtml>
</config>

I don't display the observer because it's a little big and it works. If you still need it I can add it later.

Thanks


texts:
I don't see the patch SUPEE-11155 for Magento version 1.9.3.10 in the Magento site https://cl.ly/c96fd50d706d . Is this patch not needed for 1.9.3.10?
I tried to install for version 1.9.3.9 and 1.9.4.0 but I faced some issues. I was wondering: If I should go and fix the errors, apply the patch manually from files not bash, or should not apply it?


texts: How to mass delete products from disabled categories?

texts:
I have a lot of products that are part of disabled categories. Is there a way for me to delete them all?

I want to tell it the ID of the category and then delete all the products under that category.

Is this possible?

Thank you very much!


texts:
I am trying to get a hold on our Core_URL_Rewrite table in our database. After truncating 3 months ago, we once again have 1.4million entries from 15000SKUs across 4 storeviews. The issue is so severe we are no longer able to reindex.

Currently our URLs look like this:
http://example.com/new-hi-vis-hat-12355 and change after every
reindex, making it harder to get any kind of ranking on Google.
We currently run on Magento 1.9.2.4 and have found that the EE SUPEE-389_EE_1.12.0.2_v1.patch is recommended for 1.7 and 1.8 but our developer doubts this will fix on our version.

We are willing to TRUNCATE and start again if we would be able to find a more permanent fix. Any advice at this stage would be greatly appreciated.


texts: How can we add Tracking number using third party API in order when shipment create in Magento 2.3.5?

texts:
I want to add a Tracking number using third party API when creating shipment from admin.
Also, how can we override that observer?
I am using Magento 2.3.5.
I have referred one link but it is for Magento 1.9. (How do I add tracking number to current order shipment in Magento 2?)
Please help me.


texts: Migrating Separate Installs To Multistore

texts:
I have a task where I need to merge two separate instances of Magento into one multisite. Ideally I'd also like to upgrade them to 1.8 (currently 1.5). What I'm asking for is advice on how to move products (with attributes), customers, and order data.

I'm thinking the API may be a good way of going about this on a maintainable basis. Whilst the new site is developed, the existing ones can keep running and have the data moved when it's needed. I'm not sure how feasible this is for products however due to the attributes and store associations.

Would it be easier to do complete exports of the data and write some scripts to handle the import?

Any help is really appreciated.


texts: Magento 2.2.4 Web Setup Wizard blank page

texts:
I need your help please...
After upgrade from 2.2.3 to 2.2.4 I got blank page when I click on Web Setup Wizard in System>Tools> Web Setup Wizard.
It was working before upgrade.


texts: Order confirmation mails are not sending in Magento 1.9.3.0

texts:
Recently, I setup magento 1.9.3.0 staging environment in AWS, site is working without any problem except Order confirmation mails, when i avoid cron, mails are sending  but when i use cron mails are not sending. aoe-scheduler is enabled,
cron (scheduled tasks) are set, heartbeat task schedule is set to every 5 minutes.
All the settings in admin panel are similar to live environment,

Does anyone know how to solve this issue ? i dont want to avoid cron.


texts: Magento2.3: How to integrate Salesforce?

texts:
I have to integrate Salesforce in Magento. Since I'm new for this, I'm not sure where to start.

In order to integrate this, do we need any extension or can I integrate it without extension ?

Also, is there any helpful links for Salesforce integration without using any extension ?

Your help will be greatly appreciated!


texts: Magento 1.9 - There has been an error processing your request

texts:
Printing error message, but I couldn't find that files on my server in the directory of /run

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)
Trace:
0 /var/www/html/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
1 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
2 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
3 /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
4 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
5 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
6 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql',
Object(Mage_Core_Model_Config_Element))
7 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(141):
Mage_Core_Model_Resource->getConnection('core_setup')
8 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(234):
Mage_Core_Model_Resource_Setup->__construct('core_setup')
9 /var/www/html/app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
10 /var/www/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
11 /var/www/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
12 /var/www/html/index.php(83): Mage::run('', 'store')
13 {main}


texts: Order item extension attributes are always last database entry

texts:
I have added extension attributes to order items, and values are successfully saved to table, when I get an order from rest API, extension attributes always show the value of last order item row for all other order items
1. Added event to load sales order
2.setting data to database
3.setting data to api from observer


texts: Magento 1.9.3.9 PayFlow API - Multiple Issues

texts:
I can't find a solution to this anywhere so I'm posting the very strange issues I'm having, in hopes that someone has an answer.

I've been going back and forth with PayPal support because I keep getting the error: "PayPal gateway rejected the request. User authentication failed" when clicking the "Pay with PayPal" button on my site and they're telling me a few things that don't make sense:

In the file app/code/core/Mage/Paypal/Model/Payflowpro.php it is referencing the correct URLS: https://payflowpro.paypal.com for live, and https://pilot-payflowpro.paypal.com for testing.
My [USER] => field is not passing, according to PayPal support. I have triple-checked my user credentials in System + Configuration + Payment Methods + PayPal Payment Gateways + Payflow Pro after temporarily changing the "obscure" fields to "text" so I can see what the database holds for my credentials in the /home/mydir/public_html/app/code/core/Mage/Paypal/etc/system.xml file. What I have matches what's in my Payflow Manager account.
In the shopping cart, PayPal does not show "Pay with Credit Card", only "Pay with Paypal" as an option. According to PayPal tech support, since I'm using Payflow Pro Gateway I should be seeing a "Pay with Credit Card" option as well.

Here's what I see in the error log (replacing my directory with 'mydir'):

exception 'Exception' with message 'PayPal gateway errors: User authentication failed.' in /home/mydir/public_html/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php:505
Stack trace:
/home/mydir/public_html/app/code/core/Mage/Paypal/Model/Api/Nvp.php(1009): Mage_PaypalUk_Model_Api_Nvp->_handleCallErrors(Array)
/home/mydir/public_html/app/code/core/Mage/Paypal/Model/Api/Nvp.php(617): Mage_Paypal_Model_Api_Nvp->call('SetExpressCheck...', Array)
/home/mydir/public_html/app/code/core/Mage/Paypal/Model/Express/Checkout.php(381): Mage_Paypal_Model_Api_Nvp->callSetExpressCheckout()
/home/mydir/public_html/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(108): Mage_Paypal_Model_Express_Checkout->start('https://new.domain...', 'https://new.domain...', true)
/home/mydir/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->startAction()
/home/mydir/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('start')
/home/mydir/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/home/mydir/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
/home/mydir/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/home/mydir/public_html/index.php(90): Mage::run('', 'store')

My Magento install is using the popular PORTO theme.

I'm having the same problem on 2 different servers, so it isn't isolated.

Does anyone on planet earth have any ideas?

Thank you!

MB


texts: WAMP Admin login does not work, redirected to frontend

texts: I recently copied over my live site along with database to my WAMP folder and now every time I try to get to the Backend, it redirects me to the homepage.  I'm curious if there is something in the database that I have to change.  I had to rewrite the core_config_data /base_url in order to get it to stop redirecting to the live site when I typed Localhost and I'm curious if it's an entry in my database that is causing it to reroute to the local Frontend.  I've tried localhost/admin localhost/index.php/admin and others.  Let me know if any code would help answer the question.


texts: Is it possible to delete the table from the database when uninstall the module?

texts:
Can I delete the table from the Magento database when the module is disabled and uninstalled?
Because the table was created when the module is installed.


texts: Translating: There are 3 items in your cart

texts:
While trying to translate my website to Dutch, I can't seem to translate the sentences

There are 3 items in your cart.
There is 1 item in your cart.

I have already edited the .csv files Mage_Checkout and Mage_Catalog and tried inline translation, but the text is still shown in English.
Can anyone help out?


texts: Coupons are invalid, but succesfully generated programmatically

texts:
I use this method to generate coupons with a specific SalesRule template that is existing.

/**
     * @param null|Mage_SalesRule_Model_Rule $rule
     * @param int $amount
     * @throws Mage_Core_Model_Store_Exception
     */
    public function createCoupons($rule = null, $amount = 5)
    {
        if ($rule == null && !is_null($this->salesRuleObject)) {
            $rule = $this->getRule();
        }

        /** @var Mage_SalesRule_Model_Coupon_Massgenerator $generator */
        $generator = Mage::getModel('salesrule/coupon_massgenerator');
        $data = [
            'max_probability' => .25,
            'max_attempts' => 5,
            'uses_per_customer' => 1,
            'uses_per_coupon' => 1,
            'qty' => $amount,
            'length' => 8,
            'format' => Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC,
            'dash_every_x_characters' => 4,
            'prefix' => "PH-",
            'rule_id' => $rule->getId()
        ];

        if ($generator->validateData($data)) {
            $generator->setDash($data['dash_every_x_characters'])
                ->setPrefix($data['prefix'])
                ->setData($data)
                ->generatePool();
            $rule->setCouponCodeGenerator($generator);
        };
    }

They are generated properly and inserted into my Database, which I can verify with SELECT * FROM salesrule_coupon -> it has 5 coupons after I run this method.

However, if I try to use one of the coupon in the cart it keeps show me message coupon code is invalid.

Whats wrong with the generation of the codes? Am I missing something? Does the rule needs to be worked on after generate the code?

Further information on this topic: Magento generate coupon codes programmatically


texts: Paybox error - Exception Error: Module "Quadra_Paybox" requires module "Quadra_Extensions

texts:
I get this error after installing the paybox extension for magento 1.8 community version,

  There has been an error processing your request

  Exception printing is disabled by default for security reasons.

  Error log record number: 1068071763

Any idea what has gone wrong with it and how can I fix it?

By the way, I downloaded the paybox extension via this link http://freegento.com/ddl-magento-extension.php after following the answer from here.

EDIT:

the content of Magento/var/report/1068071763,

a:4:{i:0;s:59:"Module "Quadra_Paybox" requires module "Quadra_Extensions".";i:1;s:807:"#0 C:\wamp\www\argenties_magento_2014\app\code\core\Mage\Core\Model\Config.php(849): Mage::throwException('Module "Quadra_...')
#1 C:\wamp\www\argenties_magento_2014\app\code\core\Mage\Core\Model\Config.php(812): Mage_Core_Model_Config->_sortModuleDepends(Array)
#2 C:\wamp\www\argenties_magento_2014\app\code\core\Mage\Core\Model\Config.php(315): Mage_Core_Model_Config->_loadDeclaredModules()
#3 C:\wamp\www\argenties_magento_2014\app\code\core\Mage\Core\Model\App.php(414): Mage_Core_Model_Config->loadModules()
#4 C:\wamp\www\argenties_magento_2014\app\code\core\Mage\Core\Model\App.php(343): Mage_Core_Model_App->_initModules()
#5 C:\wamp\www\argenties_magento_2014\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#6 C:\wamp\www\argenties_magento_2014\index.php(87): Mage::run('', 'store')
#7 {main}";s:3:"url";s:24:"/argenties_magento_2014/";s:11:"script_name";s:33:"/argenties_magento_2014/index.php";}


texts: Magento does not display changes committed in the Manage categories

texts:
I have been passed a developed magento shop and I wanted to remove from sight some categories from the main menu on the frontpage, yet, it will continue showing up despite having selected Included in Navigation Menu: No

That is, Catalog- Manage Categories- General Information

I also tried changing to: Is Active? No.

and then I click on save category, I refresh the frontpage and it keeps showing. I dont understand. I even checked with other browsers to make sure I wasn't seeing the cache.

I have then tried other thing. At the Directory tree of categories, I have dragged that category up to insert it inside another one. It should have then disappeared from the Main navigation menu and be included in the list of dropdown items. Nothing of the sort happened. It continues showing up in the main menu despite the Directory tree having been changed.

I am flummoxed.

I have noticed one thing and it may be the key:

The categories does not show a Default Category. Instead, whoever made the site, replaced that by a named category such as OurShop.

What to do then?


texts: Implement recent security patches immediately

texts:
While I am trying to update security patches I got following error message.

Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Admin/Model/Observer.php
Hunk #1 FAILED at 37.
Hunk #2 FAILED at 44.
Hunk #3 FAILED at 55.
3 out of 3 hunks FAILED -- saving rejects to file app/code/core/Mage/Admin/Model/Observer.php.rej
patching file app/code/core/Mage/Core/Controller/Request/Http.php
Hunk #1 succeeded at 39 with fuzz 1 (offset 1 line).
Hunk #2 succeeded at 537 (offset 1 line).
patching file lib/Varien/Data/Collection/Db.php
Hunk #1 FAILED at 442.
1 out of 1 hunk FAILED -- saving rejects to file lib/Varien/Data/Collection/Db.php.rej

How can I update patches in this regard ??


texts:
I am going through this link to understand Layout handles. Here I have seen that the layout handles are in the form of [module_front_name]_[controller_name]_[action_name]. So, for example the layout handle for "Contact us" page is contacts_index_index, which calls the "indexAction" method available in "indexController" controller of "Contacts" module.

Later, I have seen other layout handles like:

page_empty
page_one_column
page_two_columns_left
page_two_columns_right
page_three_columns

in "page.xml" layout file. (which are also in config.xml file of "page" module)

The above Layout handles are not in the form of [module_front_name]_[controller_name]_[action_name]. Then what are they?

My understanding is not  clear on both the types of Layout handles. (Are there any other Layout handle types?)

Please explain


texts: Get category not include_in_menu or disabled

texts:
On my start page I have a product slider block where I show categories. Now I would like to have a category that is not in the menu but in the slide.

Problem is that if disable the category of set include_in_menu to false I don't get the category in the slider. Here is the slider query:

    $_helper = Mage::helper('catalog/category');
    $children = $_helper->getStoreCategories(false, true, false)
        ->addAttributeToSelect('product_slider')
        ->addAttributeToFilter('product_slider', array('neq' => ''))
        ->addAttributeToFilter('path', array('like' => "1/{$rootCategoryId}/%"))
        ->addOrderField('product_slider')
        ->addOrderField('name');

How do I get a catgory with include_in_menu = false.


texts: send Observer data to phtml file in Magento 2

texts:
I am trying to send Observer info into the block file. used the add to cart event as like below.
app/code/Vendor/Module/etc/events.xml
<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  <event name="checkout_cart_product_add_after">
      <observer name="event_observer_checkoutcartproductaddafterwe" instance="Vendor\Module\Observer\Checkoutcartproductaddafter" />
  </event>
</config>

Then
app/code/Vendor/Module/Observer/Checkoutcartproductaddafter.php
<?php
 namespace Vendor\Module\Observer;
 class Checkoutcartproductaddafter implements \Magento\Framework\Event\ObserverInterface
 {
  protected $layout;
  public function __construct(
    \Magento\Framework\View\Layout $layout)
   {
    $this->layout = $layout;
   }
  public function execute(\Magento\Framework\Event\Observer $observer)
  {
    $event = $observer->getEvent();
    $eventData = $event->getData('quote_item');
    $item = ($eventData->getParentItem() ? $eventData->getParentItem() : $eventData);
    $product = $item->getProduct();
    $productId = $product->getId();
      $prepareJson = array(
             'Added To Cart' => array(
             'productId' => $productId,
             'productName' => $product->getName(),
          )
        );
     $block = $this->layout->createBlock('Vendor\Module\Block\Index\Index')->setTemplate('Vendor_Module::before-body-end.phtml')
        ->setObserverData($prepareJson)
        ->toHtml();
     }
   }

Vendor/Module/view/frontend/templates/before-body-end.phtml
<?php
 $jsonData = $block->getObserverData();
?>
<script id='test_script' type='text/javascript'>
  console.log('inside');
  var data = '<?php echo $jsonData; ?>';
  console.log('--data--',data);
</script>

From the above code I am able to pass the observer data into the phtml file, but I am trying to print the received info into the browser console.
Once printed in browser i have to send to a third party tool using javascript function.
The problem is whatever js is written That's not working. Please help me how can we achieve this. Thanks in Advance!!


texts: PHP - How to select all users ever paid an order

texts:
I am working on a custom Magento Extension.

I am wondering how can i select all users who ever paid an order. I mean users which have one order with status complete.

Here is the code that has been given to me for this purpose, but it is not working as intended:

$customers = Mage::getModel('customer/customer')
    ->getCollection()
    ->addAttributeToSelect('*');

    $customers->joinTable(
            array('sales/order'),
            'customer_email=email',
            array('*'),
            null,
            'right'
        );

$data = $customers->getData();
foreach($data as $d)
{
    //print_r($d); // print this to see the available fields
    echo $d[customer_email]; //get the desired information
    echo "<br>";
}

Right now i am wondering is it even possible ?


texts: Magento Related Products - Relating all products to each other

texts:
Let's say that I have a product that has 15 products that should be related to it.

I go to the admin panel and add those products on the "related products" field. Simple.

Is there a way to have all the other 15 products related to each other as well?  Or is the only way to go into each product and add the same related products manually?


texts: Magento 2.4.2: Disable sales_grid_order_async_insert

texts: Is disabling sales_grid_order_shipment_async_insert, sales_grid_order_async_insert  sales_grid_order_creditmemo_async_insert and sales_grid_order_invoice_async_insert advisable from the perspective of site's performance?


texts: Authentication popup issue only on home page

texts:
I bought a theme but the support period has expired and they no longer respond to my emails.

The authentication popup did not work on the proceed to checkout button (mini-cart & cart).
I found this piece of code in app/design/frontend/[Vendor]/[theme]/Magento_Theme/layout/default.xml :

<referenceBlock name="authentication-popup" remove="true"/>

After override the layout, the popup appears correctly except on the home page.
I try to remove all modules, also try with a fresh install.

Any idea?


texts:
I get the following error when trying to make a configurable product on Magento 1.9

Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available.

I've tried this already, but it isn't working :S


texts: Magento2 : On update of quote item price i am not able to get payment method on payment step

texts:
on the update of quote item price, I am not able to get payment method on payment step in Magento2. It is showing No Payment Methods. Below is my code on beforeSaveAddressInformation for the plugin.

$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);
$item->save();

public function beforeSaveAddressInformation(
    \Magento\Checkout\Model\ShippingInformationManagement $subject,
    $cartId,
    \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation
) {
    $postcode = $addressInformation->getShippingAddress()->getPostcode();
    $zipcodeData = $this->location_pricing->getCollection()->addFieldToFilter('post_code',$postcode)->addFieldToFilter('flag',1)->getFirstItem();

    // $cart = $this->quoteRepository->get($cartId);;
    $cart = $this->cart->getQuote();
    $quotePincode = $cart->getPincode();

    $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/cityprice.log');
    $logger = new \Zend\Log\Logger();
    $logger->addWriter($writer);

    if($quotePincode != $postcode){
        $items = $cart->getAllVisibleItems();
        $result = [];
        $product = $this->productFactory->create();
        $cart->setPincode($postcode);
        $cart->setPincodeCity($zipcodeData->getCity());
        if (count($items) > 0){
            foreach ($items as $item){
                $_product = $product->loadByAttribute('sku',$item->getSku());
                $result[] = $item->getSku();
                $cityCollection = $this->pricing->getCollection()->addFieldTofilter('city',$zipcodeData->getCity())
                ->addFieldToFilter('sku',$item->getSku())
                ->getFirstItem()->getData();

                if(!empty($cityCollection)){
                    if($cityCollection['location_special_pricing'] > $cityCollection['location_price'] )
                        $price = $cityCollection['location_price'];
                    else
                        $price = $cityCollection['location_special_pricing'];

                    $item->setCustomPrice($price);
                    $item->setOriginalCustomPrice($price);
                    $item->getProduct()->setIsSuperMode(true);
                    $item->save();
                }
                else{
                    if(($_product->getData('special_price') > 0) && ($_product->getData('special_price') < $_product->getData('price')))
                        $price = $_product->getData('special_price');
                    else
                        $price = $_product->getData('price');

                    $item->setCustomPrice($price);
                    $item->setOriginalCustomPrice($price);
                    $item->getProduct()->setIsSuperMode(true);
                    $item->save();
                }
            }
            $this->quoteRepository->save($cart);
            $cart->save();
        }
    }
}

My di.xml is below

<type name="Magento\Checkout\Model\ShippingInformationManagement">
    <plugin name="sr_save_delivery_date_in_quote" type="Vendor\Module\Plugin\Checkout\Model\ShippingInformationManagement" sortOrder="1"/>
</type>


texts: Cookie issue on customer login magento - Chrome

texts:
HI I am facing a weird issue only on Opera and Chrome. I cannot login with a customer account. This is my configuration:

I tried to change the domain like:

www.myurl.de
myurl.de
leave it empty

None of them are working. The form key is set in the <form>, in the logs file nothing.
I commented the code

call_user_func_array(‘session_set_cookie_params’, $cookieParams);

from Varien.php
and from public function login($username, $password)

$this->renewSession();

The Fpc is disabled. The sessions are stored in db. I don't know what else should I try ?


texts: How to render login error message in product page?

texts:
If a user tries to login with wrong credentials then normally a message appears which says "login failed", it works if I do it on the normal login form at /customer/account/login/

But if I am at a product and attempt to login with wrong credentials then the site just reloads but no error messages shows. But if I then go to the site /customer/account/login/ then I see that the error message is rendered there.

If I attempt to login two times with wrong credentials in the product page and then go back to /customer/account/login/, then the message is getting rendered two times.

I looked up the code from the login page to find out which codeline is needed to show the error messages and found this code:

<?php echo $this->getMessagesBlock()->toHtml() ?>

so I added it to the product view, but it is still not rendering.

I also added this code:

<?php
$debugObject = Mage::getSingleton('customer/session')->getMessages();

echo "Last added message: '" . $debugObject->getLastAddedMessage() . "'

";
echo "getErrors: " . var_dump($debugObject->getErrors()) . "

";

Now I get this output:

Last added message: ''

array(1) { [0]=> object(Mage_Core_Model_Message_Error)#137 (6) { ["_type":protected]=> string(5) "error" ["_code":protected]=> string(39) "Ungültiger Benutzername oder Passwort." ["_class":protected]=> string(0) "" ["_method":protected]=> string(0) "" ["_identifier":protected]=> NULL ["_isSticky":protected]=> bool(false) } } getErrors:

But I still don't know how I can show the message in a regular way.

I was only able to hack it into the view (app\design\frontend\venedor\custom\template\catalog\product\view.phtml) like this, but I don't think that this is the way to go:

<?php $session = Mage::getSingleton('customer/session'); ?>
<?php if ($session->getMessages()->toString()) { ?>

            <button type="button" class="close" data-dismiss="alert">×</button>

<?php echo str_replace ('error: ', '', $session->getMessages()->toString()) ?>

    <?php $session->getMessages()->clear(); ?>

<?php } ?>

There must be a cleaner solution. Why is <?php echo $this->getMessagesBlock()->toHtml() ?> not working on the product view?


texts: how to change csv file name of Dataflow- Advanced profile on run time

texts:
I want to use Dataflow-Advanceed profile to import the csv from frontend. i have googled and find a stand-alone script for that, but problem is that now this script work only for fixed csv file. I want to change the csv file name on run time to import through stand-alone script. Please refer screen-shot link https://www.diigo.com/item/image/5hhy6/7pxw to more clear. Could anyone help me to get achieve this?

Here is sample script:

require_once 'app/Mage.php';
umask(0);
ini_set("memory_limit","1024M");
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML,
Mage_Core_Model_App_Area::PART_TRANSLATE);
setlocale(LC_ALL, 'en_US');
$localeName = "en_US";
Mage::app()->getLocale()->setDefaultLocale($localeName);
Mage::app()->getLocale()->setLocale($localeName);
Mage::app()->getLocale()->setLocaleCode($localeName);
setlocale(LC_ALL, Mage::app()->getLocale()->getLocaleCode());
Mage::app()->setCurrentStore(0);
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML, Mage_Core_Model_App_Area::PART_TRANSLATE);

Mage::app();
$profileId = 11; //put your profile id here
$logFileName= date("j-n-Y")."-import.log";
$recordCount = 0;
Mage::log("Import Started",null,$logFileName);
$profile = Mage::getModel('dataflow/profile');
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
Mage::getSingleton('admin/session')->setUser($userModel);
if ($profileId) {
    $profile->load($profileId);
    if (!$profile->getId()) {
        Mage::getSingleton('adminhtml/session')->addError('The profile you are trying to save no longer exists');
    }
}
Mage::register('current_convert_profile', $profile);
$profile->run();
$batchModel = Mage::getSingleton('dataflow/batch');
if ($batchModel->getId()) {
    if ($batchModel->getAdapter()) {
        $batchId = $batchModel->getId();
        $batchImportModel = $batchModel->getBatchImportModel();
        $importIds = $batchImportModel->getIdCollection();
        $batchModel = Mage::getModel('dataflow/batch')->load($batchId);
        $adapter = Mage::getModel($batchModel->getAdapter());
        $adapter->setBatchParams($batchModel->getParams());
        foreach ($importIds as $importId) {
            $recordCount++;
            try{
                $batchImportModel->load($importId);
                if (!$batchImportModel->getId()) {
                    $errors[] = Mage::helper('dataflow')->__('Skip undefined row');
                    continue;
                }
                $importData = $batchImportModel->getBatchData();
                try {
                    $adapter->saveRow($importData);
                } catch (Exception $e) {
                    Mage::log($e->getMessage(),null,$logFileName);
                    continue;
                }
                if ($recordCount%20 == 0) {
                    Mage::log($recordCount . ' - Completed!!',null,$logFileName);
                }
            } catch(Exception $ex) {
                Mage::log('Record# ' . $recordCount . ' - Error - ' . $ex->getMessage(),null,$logFileName);
            }
        }
        foreach ($profile->getExceptions() as $e) {
            Mage::log($e->getMessage(),null,$logFileName);
        }
    }
}
Mage::log("Import Completed",null,$logFileName);

Looking forward for positive response!

Thanks in advance!


texts:
I have 3 payments methods activated on the store.

paypal, transfers and billet banking.

So, if the payment is made through transfers and billet banking, we have 10% discount. The rule is ok!

So, when I click the 1 time on the radio button of transfers or billet, the discount does not appear on the total, but, if I click before on paypal and after on the transfers or billet, the discount works.

So, what could it be? JS?

My site: www.comerciomix.com.br


texts: How to save another data for Authorization Role in Magento 2

texts:
Hi Everyone i need help with this case. How can i save   with a plugin with this additional data "Extra Data" ?
Reference:

How can i add this "extra-data" with the rest of the info of AUthorization Role ?? Please help!

Just in case i've added the column extra_data on the table authorization_role


texts: Want to make a magento site, product's weight oriented

texts:
I want to start a magento site with the following constraints

Product should be listed according to weight instead of price
The customer is allowed to add any number of product in his cart and total weight shows up at checkout time
The customer can place the final order with COD option after paying some minimum amount online calculated dynamically based upon the total weight of items in the cart.

P.S. I am a good programmer and knows basics of Javascript and PHP but I am new to magento.
For this site I will be using a paid template purchased from ThemeForest


texts: Magento 2 Associate simple product to Configurable product

texts:
I need to import 40,000 product from xls so that reason I wrote an importer, I already did for magento 1.x but we switch our web site magento 2,
I can create simple and configurable product programatically but I cant associate simple product to configurable product, This is the best documentation I followed,

Programmatically create a configurable product and assign the simple product to configurable product in Magento2 product

But I stuck configurable product options always throw an error,

Call to a member function getId() on array in .../vendor/magento/module-configurable-product/Model/Plugin/AroundProductRepositorySave.php on line 109

Here is my code,

$configurableProductOptions = [
[
"attribute_id" =>  137,
"label" => 'size',
"position" => 0,
"values" => [
[
"value_index" =>  333,
],
[
"value_index" =>  334,
]
],
]
];

$product->setCanSaveConfigurableAttributes(true);
$product->setCanSaveCustomOptions(true);
$productExtensionFactory= $objectManager->create('\Magento\Catalog\Api\Data\ProductExtensionFactory');
$productExtension = $productExtensionFactory->create();
$productExtension->setConfigurableProductLinks($sipmle_product_ids);
$productExtension->setConfigurableProductOptions([
                                                $configurableProductOptions
                                                 ]);
$product->setExtensionAttributes($productExtension);
$productRepository = $objectManager->create(Magento\Catalog\Api\ProductRepositoryInterface::class);

$productRepository->save($product,true);

I m totaly sure something wrong in '$configurableProductOptions' tried almost everything but didnt succeed any ideas or anyone can share code to associate simple product as a configurable I can figured out from that code.


texts:
Do we have any choice of calling a callback function for sorting?
Just like

filter_condition_callback

As

 'sort_callback' => array($this, 'sortingfun'),


texts:
I'm trying to finalize a recurring purchase in magento and I'm getting this error below

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`loja`.`sales_recurring_profile`, CONSTRAINT `FK_SALES_RECURRING_PROFILE_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE), query was: INSERT INTO `sales_recurring_profile` (`state`, `customer_id`, `store_id`, `method_code`, `created_at`, `updated_at`, `start_datetime`, `internal_reference_id`, `schedule_description`, `period_unit`, `period_frequency`, `period_max_cycles`, `billing_amount`, `currency_code`, `shipping_amount`, `order_info`, `order_item_info`, `billing_address_info`, `shipping_address_info`, `profile_vendor_info`, `additional_info`) VALUES (?, ?, ?, ?, '2020-03-31 14:34:25', '2020-03-31 14:34:25', '2020-03-31 14:34:25', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)


texts: How to reload the quote or cart in Magento 2

texts:
I am working on ajax cart.
When i update the cart qty, I am trying to reload the quote but its not loading properly

$this->cart->getQuote()->getShippingAddress()->collectShippingRates()->save();
$this->cart->getQuote()->setTotalsCollectedFlag(false);
$this->cart->getQuote()->collectTotals();
$this->cart->getQuote()->save();

How to reload the quote so that total calculation should happen properly
in magento1 we use cart::init()


texts: Magento 1.9 How to call any api on event "sales_order_invoice_register"?

texts:
I want to call my custom API on sales_order_invoice_register event. Menas, when the invoice will generate, will call my custom API and I want to store the response in Database.
Will this kind of functionality feasible for this event?
Also, can I use curl call here? or any other method?
Can anyone have any idea about it?


texts:
getting this error and honestly don't know where to start search for the problem.

Warning: simplexml_load_string(): Entity: line 1: parser error : Malformed declaration expecting version  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 451

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/var/www/html/m...', 451, Array)
#1 /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php(451): simplexml_load_string('getFileLayoutUpdatesXml('frontend', 'rwd', 'default', '1')
#3 /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php(347): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#6 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(306): Mage_Core_Model_Layout_Update->load()
#7 /var/www/html/magento/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /var/www/html/magento/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 /var/www/html/magento/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#11 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/html/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /var/www/html/magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /var/www/html/magento/index.php(87): Mage::run('', 'store')
#16 {main}

Any helping suggestion ?


texts: how to handle redirection url in port forwarding - docker container

texts:
I build magento application in docker container, I am trying to access that container from remote machine using docker port forwarding.

System A

create container : docker run -it -d -p 8000:80 -h tm.gworks.mobi -v /var/www/public --privileged --name testmachineone magedev

container ip : 172.17.0.2

System A ip : 192.168.1.6

I can able to access webserver using both ip in system A http://172.17.0.2 && http://192.168.1.6:8000

note: if I access http://192.168.1.6:8000 it will get automatically redirect to http://172.17.0.2 that is default behavior of magento.

System B

if I access http://192.168.1.6:8000 it will get automatically redirect to http://172.17.0.2 but system B can't able to access http://172.17.0.2  so it throws 404 error..

as per my search we can't access docker container ip from remote host, only way is port forwarding. But I stuck with URL redirection in port forwarding.

is there any way to stop redirection in port forwarding?


texts:
I update Magento from 1.9.3.0 to 1.9.3.7

magento log this error in system.log

  Warning: array_merge_recursive() expects at least 1 parameter, 0 given
  in
  /home/example/domains/example.com/public_html/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
  on line 336 2018-12-10T08:05:18+00:00 ERR (3): Warning: array_unique()
  expects parameter 1 to be array, null given in
  /home/example/domains/example.com/public_html/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
  on line 337

and this is the function in Productimg.php

 public function filterImageInGallery($product, $image)
    {
        if (!Mage::helper('configurableswatches')->isEnabled()) {
            return true;
        }

        if (!isset($this->_productImageFilters[$product->getId()])) {
            $mapping = call_user_func_array("array_merge_recursive", $product->getChildAttributeLabelMapping());
            $filters = array_unique($mapping['labels']);
            $filters = array_merge($filters, array_map(function ($label) {
                return $label . Mage_ConfigurableSwatches_Helper_Productimg::SWATCH_LABEL_SUFFIX;
            }, $filters));
            $this->_productImageFilters[$product->getId()] = $filters;
        }

        return !in_array(Mage_ConfigurableSwatches_Helper_Data::normalizeKey($image->getLabel()),
            $this->_productImageFilters[$product->getId()]);
    }

how can I solve this problem?


texts:
When we are saving any frontend form, it is showing the success message on same page and also on all other pages.

It also shows the messages after reload.


texts: How to print timezone in order confirmation email template

texts:
I am trying to print the store timezone in order confirmation email. In my email template, I have added the order date as follows,

{{trans ' Order Placed on %created_at' created_at=$order.getCreatedAtFormatted(2) |raw}}

I have set the time zone for the store as

But in my order confirmation email, I am not able to see the time zone with the date. It just shows as,

Placed on Dec 26, 2019, 3:40:30 PM.

I would like to add he timezone after the time in order confirmation email.
Anyone know how to do this ?


texts: $this deprecated in template logic. What's the alternative?

texts:
In this https://github.com/magento/magento2/blob/2.3/app/code/Magento/Contact/view/frontend/templates/form.phtml you see something like this

$this->helper('Magento\Contact\Helper\Data')->getUserEmail())

In code quality checks I see $this in templates is now deprecated

What's the recommended approach?


texts: How to add a new field in cart price rule form in magento 2 backend?

texts:
I need to add a new dropdown field in the "CART PRICE RULE" form in  Backend:

MARKETING > PROMOTIONS > CART PRICE RULES > ADD NEW RULE


texts: Magenot 2 SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.sales_order' doesn't exist

texts:
I'm getting an error when I navigate to the order grid section of the magento 2.3.4 under Sales -> Orders in the admin panel. It appears to be referencing the wrong table because table 'databasename.prefix_sales_order' does exist but below the error is calling table'databasename.sales_order'. How would I fix this?
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.sales_order' doesn't exist, query was: SELECT COUNT(*) FROM `prefix_sales_order_grid` AS `main_table`  LEFT JOIN `sales_order` ON main_table.entity_id = sales_order.entity_id [] []


texts: Update Magento 1.4.1.1. to first 1.4.2 but "No releases for package "magento-core/Mage_All_Latest" exist"

texts:
I'm using exactly the same method described in this question but i get the following errors:

  No releases for package "magento-core/Mage_All_Latest" exist

  Cannot initialize
  'channel://connect.magentocommerce.com/core/Mage_All_Latest-stable',
  invalid or missing package file

  Package
  "channel://connect.magentocommerce.com/core/Mage_All_Latest-stable" is
  not valid

  upgrade failed

I have googled and tried to find a solution but no success. Can anybody help me that which procedures i have to try next?

Thank you!


texts: Magento tries to load file from src folder

texts:
Error in file:
  "/var/www/test/magento_custom/app/code/community/Fabric/Material/data/fabric_material_setup/data-install-1.0.0.0.1.php"
  -Warning: include(/var/www/test/magento_custom/includes/src/Fabric_Material_Model_Material.php):
  failed to open stream: No such file or directory  in
  /var/www/test/magento_custom/includes/src/Varien_Autoload.php on line
  94

I am having this issue, when install custom module. What would be the issue?

sql setup file.

$installer = $this;

/**
 * Creating table fabric_news
 */
$table = $installer->getConnection()
    ->newTable($installer->getTable('fabric_material/material'))
    ->addColumn('news_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'unsigned' => true,
        'identity' => true,
        'nullable' => false,
        'primary'  => true,
    ), 'Entity id')
    ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
        'nullable' => true,
    ), 'Title')
    ->addColumn('author', Varien_Db_Ddl_Table::TYPE_TEXT, 63, array(
        'nullable' => true,
        'default'  => null,
    ), 'Author')
    ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '2M', array(
        'nullable' => true,
        'default'  => null,
    ), 'Content')
    ->addColumn('image', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'News image media path')
    ->addColumn('published_at', Varien_Db_Ddl_Table::TYPE_DATE, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'World publish date')
    ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
        'nullable' => true,
        'default'  => null,
    ), 'Creation Time')
    ->addIndex($installer->getIdxName(
            $installer->getTable('fabric_material/material'),
            array('published_at'),
            Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX
        ),
        array('published_at'),
        array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX)
    )
    ->setComment('Material item');

$installer->getConnection()->createTable($table);

data setup file.

$installer = $this;

/**
 * @var $model Fabric_News_Model_News
 */
$model = Mage::getModel('fabric_material/material');

// Set up data rows
$dataRows = array(
    array(
        'title'          => 'Cotton',
        'content'        => '
Suitable for very sunny climate
',
        'created_at'=>'2015-02-13 13:14:47'
    ),
     array(
        'title'          => 'Synthetic',
        'content'        => '
Suitable for very sunny climate
',
        'created_at'=>'2015-02-13 13:14:47'
    )
);
// Generate news items
foreach ($dataRows as $data) {
    $model->setData($data)->setOrigData()->save();
}


texts: Custom field in the form not saving values in to the Database in magento 2.1

texts:
I have created a custom attribute for customer using below code.

  setup/installData.php

$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, 'samsung', [
        'type' => 'varchar',
        'label' => 'Samsung ',
        'input' => 'boolean',
        'source' => '',
        'required' => false,
        'visible' => true,
        'position' => 166,
        'system' => false,
        'backend' => ''
    ]);

    $attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'samsung')
        ->addData(['used_in_forms' => [
            'adminhtml_customer',
            'adminhtml_checkout',
            'customer_account_create',
            'customer_account_edit'
        ]]);
    $attribute->save();

I am using below front-end code but data is not stored in the database:

        <input type="checkbox" name="acs" id="apple" value="Apple" class="checkbox">apple

        <input type="checkbox" name="acs" id="samsung" value="Samsung" class="checkbox">Samsung

        <input type="checkbox" name="acs" id="sony" value="Sony" class="checkbox">Sony

        <input type="checkbox" name="acs" id="dell" value="Dell" class="checkbox">Dell

    <input type="button" onclick='selectAll()' value="Select All"/>
    <input type="button" onclick='UnSelectAll()' value="Unselect All"/>


texts:
I have magento website at this link:

It's not loading shopper theme files. Theme original look is:-

http://sw-sol-world.com/clients/pet/index.php/home/?___store=default

What should I do in theme settings? Please help.


texts: Add custom Js and css to admin panel Magento 1.9

texts:
In

  /magento1/app/design/frontend/base/default/layout/instagramapi.xml

    <?xml version="1.0"?>
<layout version="0.1.3">
<adminhtml_system_config_edit>
    <reference name="head">
        <action method="addCss">
           <name>instagramapi/css/hBratingsliderAdmin.min.css</name>
        </action>
        <action method="addJs">
             <script>instagramapi/js/jscolor/jscolor.js</script>
        </action>
    </reference>
</adminhtml_system_config_edit>
    <default>
       <reference name="head">
    .............

file is located at

  magento1/skin/adminhtml/default/default/instagramapi/js/jscolor/jscolor.js

and

  /magento1/skin/adminhtml/default/default/instagramapi/css/hBratingsliderAdmin.min.css

is there any error in this code as no css or js file is included in admin panel


texts: Why does my ajax add to cart not push the right product to the cart?

texts:
I am building a shopping cart in Magento and I am trying to get the add to cart working with an ajax push from a button in a form. In the markup for the products they are listed in a slider and in this slider I have the product details like image, name, variants etc. The problem I get is that when I press submit on the button, the ajax looks like its happening so I go and check the network tab in the inspector and see that I get a successfully sent ajax submit but when I refresh nothing seems to be in the cart.

One thing to also mention is that the url in network I see starts with

/ajax/index/add/uenc/--encryptedcode/product/idnumber

I am not sure if thats correct for add to cart, in the form action I am using this php to capture that for the product but in the form action rendered I see nothing at all. When I type say www.google.co.uk into the action tag it shows up on all the forms:

action="<?php echo $this->getSubmitUrl($_product) ?>"

I also know that in some cases this has been used in Magento sites:

<a href="#" class="buy-button buying-options js-add-to-cart button" data-products-in-cart="<?= $products_in_cart ?>">

And this above code spits out the html to be something like this which is the correct url to add a product into the cart:

Add another!

I am also going to show you the js I use to push the form up with ajax:

var productAddToCartForm = new VarienForm('product_addtocart_form');
    productAddToCartForm.submit = function (button, url) {
        //if (this.validator.validate()) {
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
                form.action = url;
            }
            var e = null;
            // Start of our new ajax code
            if (!url) {
                url = jQuery('#product_addtocart_form').attr('action');
            }
            url = url.replace("checkout/cart", "ajax/index"); // New Code
            var data = jQuery('#product_addtocart_form').serialize();
            data += '&isAjax=1';
            jQuery('#ajax_loader').show();
            try {
                jQuery.ajax({
                      url: url,
                      dataType: 'json',
                      type : 'post',
                      data: data,
                      success: function(data){
                          jQuery('#ajax_loader').hide();
                              //alert(data.status + ": " + data.message);
                              if(jQuery('.block-cart')){
                                  jQuery('.block-cart').replaceWith(data.sidebar);
                              }
                              if(jQuery('.header .links')){
                                  jQuery('.header .links').replaceWith(data.toplink);
                              }
                      }
                });
            } catch (e) {
            }
            // End of our new ajax code
            this.form.action = oldUrl;

            if (e) {
                throw e;
            }
        //}
    }.bind(productAddToCartForm);

Is the above php correct because I get nothing in the returned action tag at all and this I think is where I may be going wrong with this.

Can anyone figure out why it would not show the correct url for the product add to cart?


texts: Custom collection pager is not shown in magento 2

texts:
Custom collection pager is not shown in Magento 2
status.php
 public function getProduct()
    {
        //get values of current page
        $page=($this->getRequest()->getParam('p'))? $this->getRequest()->getParam('p') : 1;
        //get values of current limit
        $pageSize=($this->getRequest()->getParam('limit'))? $this->getRequest()->getParam('limit'):20;

        $productItems =  $this->productCollectionFactory->create();
        $productItems->addAttributeToSelect('name');
        $productItems->setPageSize($pageSize);
        $productItems->setCurPage($page);

        return $productItems;
    }

 protected function _prepareLayout()
 {

    parent::_prepareLayout();
    $this->pageConfig->getTitle()->set(__('Low Stock Products'));

    if ($this->getProduct()) {
        $pager = $this->getLayout()->createBlock(
            'Magento\Theme\Block\Html\Pager',
            'lowstocknotification.status.pager'
        )->setAvailableLimit(array(5=>5,10=>10,15=>15,20=>20))
            ->setShowPerPage(true)->setCollection(
            $this->getProduct()
        );
        $this->setChild('pager', $pager);
        $this->getProduct()->load();
    }
    return $this;
}

public function getPagerHtml()
{
    return $this->getChildHtml('pager');
}

stockgrid.phtml
<?php if ($block->getPagerHtml()): ?>

<?php echo $block->getPagerHtml(); ?>

<?php else: ?>

<?php echo __('No any record.'); ?>

<?php endif ?>

Output:


texts:
I have a little problem (which should be easy to solve), with a custom module I try to execute through crontab. For now, the only thing it is supposed to do is to print a log entry in dev.log file. Unfortunately, it doesn't, that's why I look for some help.

Below is how I've created my module.

app/etc/modules/Mycompany_Cronmodule.xml

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

app/code/local/Mycompany/Cronmodule/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mycompany_Cronmodule>
            <version>1.0</version>
        </Mycompany_Cronmodule>
    </modules>

    <global>
        <models>
            <cronmodule>
                <class>Mycompany_Cronmodule_Model</class>
            </cronmodule>
        </models>
    </global>

    <crontab>
        <jobs>
            <mycompany_cronmodule>
                <schedule><cron_expr>* * * * *</cron_expr></schedule>
                <run><model>cronmodule/observer::test</model></run>
            </mycompany_cronmodule>
        </jobs>
    </crontab>
</config>

app/code/local/Mycompany/Cronmodule/Model/Observer.php

class Mycompany_Cronmodule_Model_Observer {

    public function test(){
        Mage::log("TEST success", null, "dev.log");
    }
}

I have configured my windows task manager to execute cron.php every 5 minutes which works perfectly to send Magento emails (I run a local instance on a local windows with wamp).

Do you have any hints ?


texts: 1.9 CE - Set variable to either region or region_id if customer in USA

texts:
Appologies but new to PHP...

Need to pass a value for 'state' to payment gateway which can be any string for non USA customers but must be two character code for USA (based on drop down list).

'State'=> $billingaddress->getData('region'),

'State'=> $billingaddress->getData('region_id'),

are the two variable.

Not sure of the if else syntax for setting 'state' as 'region_id' if country is USA and 'region' for all other countries.  Thanks


texts: why i should not use object manager directly in magento2?

texts:
Magento 2 uses dependency injection means when ever client required any services we have to pass in constructor.

So magento take care like automatically create objects recursively..

but there is a statement like we should not use object manager.
I'm very confusing on this part.
Can you some one explain ?


texts: Magento 2 : Sales Order Report Adding Text Field

texts:
How do I add custom text field under sales -> orders -> filters? If you look under filters there is a field called "Ship to name" you can type query here. But instead, I wanted a field called "products" so I can filter products names.

Thanks in advance


texts: Fake POST for $this->getRequest()->isPost()

texts:
how to create a fake POST to bypass

    $_POST = array('blahblah'=>1);
    $_REQUEST = array('blahblah'=>1);

    if($this->getRequest()->isPost())
    {
        echo 'horray bypassed';
    }else
    {
           echo ':(';
    }

and is not working

here the answer:

$_SERVER['REQUEST_METHOD'] = 'POST';
/* by pass */

$this->getRequest()->isPost()


texts: How to fix 'Magento_Store' data-version not available and duplicated entry?

texts:
I'm receiving some error messages related to the Magento_Store module when I try to run the downgrade version via Magerun and when I try to change it too, as you can see in these images below.

I tried to remove it via SQL but after a setup:upgrade this issue returns.

How could I fix it?


texts:
I've installed magento and cakephp in my development server. I built a STL viewer by using cake php and gave path like this to upload files to STL viewer:

$mystlpath = $_SERVER['DOCUMENT_ROOT']."dastl/app/webroot/uploads/".$filetoinsertpost;

Now I want STL viewer to access STL files stored in magento directory. It is like accessing files from different directory which is outside root directory. How can I give a path so that STL viewer can access stl files from magento directory?
Can I try like this?

$mystlpath = $_SERVER['DOCUMENT_ROOT']."/../path_to_magento/".$filetoinsertpost;

Here is file structure to make this question more clear:

server root directory
           |www
               |dastl
               |magento


texts: Magento 2.4 alternatives to Livereload Chrome extension for live styling via Grunt?

texts:
Magento officially recommends Livereload for "watching" changes made via Grunt and updating the browser in real-time without reloading the page for each change here: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css_debug.html#add_theme
The problem is that Livereload has not been maintained and updated since 2015 and is basically unusable for me on OS X 10.15. For example the Chrome extension often falls into an infinite reloading loop which causes my browser to DOS my own server by sending an update request for the current page every second.
Can anybody recommend another app or workflow for live-updating the browser during Magento 2 development using Grunt as provided by Magento?


texts: We have installed Varninsh for magento 2.1.7. We want to get the images from original directory rather than being cached. Is this possible?