texts:
I have the fallowing domains:

www.test1.mydomain1.com
www.test2.mydomain2.com

I've created the websites and the stores that are attached to them.
From the admin panel I changed the Base URL and Base URL Link
of website1 to

http://test1.mydomain1.com

And for website2 to

http://test2.mydomain2.com

In pub/index.php I added the fallowing

$test1 = array('test1.mydomain1.com');
$test2 = array('test2.mydomain2.com');
if(in_array($params['SERVER_NAME'],$test1)){
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website1';
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
}
else if(in_array($params['SERVER_NAME'],$test2 )){
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
}

Still, when I go to www.test1.mydomain1.com everything is broken. The CSS and javascript files are not loaded apparently, and the console in dev tools shows errors like:

GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/animate.css
(index):18 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/styles-m.css
(index):21 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/owl.carousel/assets/owl.carousel.css
(index):20 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/css/bootstrap-theme.css
(index):17 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/mage/calendar.css
(index):19 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/css/bootstrap.css
(index):24 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/icon-fonts/css/porto-icons-codes.css
(index):25 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/icon-fonts/css/animation.css
(index):27 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/Smartwave_Filterproducts/css/filterproducts.css
(index):23 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/fancybox/css/jquery.fancybox.css
(index):26 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/custom.css
(index):28 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/styles-l.css
(index):131 GET http://test1.mydomain1.com/media/porto/configed_css/design_mshop_swe.css
(index):132 GET http://test1.mydomain1.com/media/porto/configed_css/settings_mshop_swe.css
(index):30 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/requirejs/require.js
(index):31 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/mage/requirejs/mixins.js
requirejs-config.js:18 Uncaught TypeError: require.config is not a function(anonymous function) @ requirejs-config.js:18(anonymous function) @ requirejs-config.js:19(anonymous function) @ requirejs-config.js:601
(index):34 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/bootstrap/js/bootstrap.min.js
(index):35 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/fancybox/js/jquery.fancybox.js
(index):33 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/jquery.js
(index):42 Uncaught TypeError: require is not a function(anonymous function) @ (index):42
(index):134 Uncaught TypeError: require is not a function(anonymous function) @ (index):134
(index):143 Uncaught TypeError: require.config is not a function(anonymous function) @ (index):143
(index):362 Uncaught TypeError: require is not a function(anonymous function) @ (index):362
(index):348 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/images/logo.svg 404 (Not Found)
(index):29 GET http://test1.mydomain1.com/static/frontend/Smartwave/porto/sv_SE/css/print.css

What am I missing ?


texts: How to provide different shipping methods in Magento2?

texts:
I am working on Magento-2.2.4 website.

How to show the different availability timings at product detailed page? And
How to show those shipping methods at checkout page?

Description is as follows :

We are maintaining own warehouse to supply the products from our warehouse to the customers. If the product is available at my warehouse, we will deliver that product within one day. But, if the product is not available at my warehouse, we will bring that from another person's warehouse to our warehouse and sure we will supply to the customer but we have to show that, Item will deliver withing 3days, within 5 days like that.


texts: Where can I find the product url key builder for Magento 2?

texts: Simple question: where can I find the function in Magento 2 which generates an url key from a products name?


texts: How to pass custom attribute from admin category page to List.php

texts:
I'd like to find out how to set up an entry box, so I can pass a string written in it from the "Manage Categories" menu to List.php.

For example, if there's a string "variable_here" for "List Visibility" under "Manage Categories -> Some Category A", you can get this variable via $layer->getCurrentCategory()->getListVisibility() in List.php.

Under "Manage Categories" -> "Some Category A"

How do I add this "List Visibility" box?


texts:
It's urgent my live site website has unaligned after running;
 "sudo bin/magento-cli setup:static-content:deploy" command.

All page alignment has changed.
Please help to fix this solution.

Please check the image below for my unaligned website. (CSS and js file are not loading)


texts: Mail Notification when Item is Out of Stock

texts:
I am trying to achieve the following:

When an item is Out of Stock send an E-Mail Notification to the warehouse.
First question would be: what's the easiest and cleanest way to achieve this?!

My approach was:

I wrote an observer which fires on the sales_order_save_after event.
So basically after every order all Items in this order should be checked wether these are still in Stock after the order.

The Observer.php looks like this:

public function checkStock($observer)
{
    $active = Mage::getStoreConfig('chimney_notifystock/general/notification_enabled');
    if ($active == 1){

        $order = $observer->getEvent()->getOrder();

        foreach ($order->getAllItems() as $item) {

            $product = $item->getProduct();
            $stockItem = $product->getStockItem();

            if ($stockItem->getIsInStock() == 0) {
                $this->sendMail($product);
            }
        }
    }
}

Now the problem is that obviously on sales_order_save_after the value of is_in_stock isn't set to 0 yet.
The getIsInStock() method always returns 1 so the sendMail() won't be executed.
Everything else works fine and the e-mail is sent correctly when I set the if ($stockItem->getIsInStock() == 0) to if ($stockItem->getIsInStock() == 1)


texts:
i am override fooman extension in community my folder path
 community/Fooman/OrderManager/Sales/controllers/OrederManager.php
i override my folder local/Mymoduel/PrintPdf/Sales/controllers/OrderMangerController.php and this is my config

                  Mymodues_PrintPdf

 –

and this is fooman community config

           Fooman_OrderManager


texts: How to change the page title of product list pages

texts:
I have a list of titles I want to overwrite the default page title on multiple product list pages with (title tag in the html head). But not on the product view page, only on the 'product list' page.

I tried creating a new custom attribute 'productlist_pagetitle' which would contain the new title. In template/page/html/head.phtml I would then use the title taken from the attribute to write it to the title tag.

However I am confused about a few things.

as far as I understand I can use the attribute as a meta field, but it is attached to a product. is there a way to link the attribute to 'product list' pages?
where / how can I actually enter my data (the new titles)?
how I can access the value of the attribute?

Sorry, I'm new to Magento and their EAV model. Any help would be greatly appreciated!


texts: How to switch between two stores just to create links

texts:
I need to to include links to categories/CMS pages in another store in my navigation menu. So it would look something like this:

<a href="<?php echo Mage::helper('cms/page')->getPageUrl('home'); ?>" <?php if ($currentUrl == Mage::helper('cms/page')->getPageUrl('home') || $currentUrl == Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)) { ?>class="active" <?php } ?>>Home

<a href="<?php echo Mage::helper('cms/page')->getPageUrl('our-products'); ?>" <?php if ($currentUrl == Mage::helper('cms/page')->getPageUrl('our-products')) { ?>class="active" <?php } ?>>Our Products

    <?php
    switch_to_another_store($store_id_2); ?>

<a href="<?php echo Mage::helper('cms/page')->getPageUrl('home'); ?>" <?php if ($currentUrl == Mage::helper('cms/page')->getPageUrl('home') || $currentUrl == Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)) { ?>class="active" <?php } ?>>Home

<a href="<?php echo Mage::helper('cms/page')->getPageUrl('our-products'); ?>" <?php if ($currentUrl == Mage::helper('cms/page')->getPageUrl('our-products')) { ?>class="active" <?php } ?>>Our Products

<?php
switch_to_another_store($store_id_1); ?>

Don't know if this will work or not, but some help would be awesome

I found a  Solution

$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation([the other store ID]);

$product= Mage::getModel('catalog/product')->load([product ID]);
echo 'getProductUrl().'">Shop now!';

$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);


texts: Magento 2 - Create order using REST API - Third Party Payment Gateway such as Paypal or other 3rd party payment gateway

texts: I need to use the Magento REST API to create an order from an API. In my case, I am trying to implement the payment directly using API to Magento. What I need to do is to create an order by setting the payment method as a Paypal or can say RazorPay or any other 3rd Party Payment method and to perform a guest checkout. Which API(s) should I use to achieve this?


texts: Magento 2 :- Add select attribute to category

texts:
I want to add a select/dropdown attribute to a category and display it in the backend to let the store owner select it. After some research I found out the following to do:

Create an attribute via Setupscript
Include it via UI component declaration

So this is what I have done:

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
    /** @var $eavSetup \Magento\Eav\Setup\EavSetup */
    $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

    $eavSetup->addAttribute(
        \Magento\Catalog\Model\Category::ENTITY,
        'attribute_code',
        [
            'type' => 'int',
            'label' => 'Top Navigation CMS Block',
            'input' => 'select',
            'source' => 'Magento\Catalog\Model\Category\Attribute\Source\Page',
            'required' => false,
            'sort_order' => 10,
            'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'MyOwnGroup'
        ]
    );
}

  view/adminhtml/ui_component/category_form.xml:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="content">
        <field name="attribute_code">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">61</item>
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="formElement" xsi:type="string">select</item>
                    <item name="label" xsi:type="string" translate="true">Top Navigation CMS Block</item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>

But that is not enough, the sorting of the tabs in the backend is mixed up. Also the dropdown gets rendered, but without options. So I found out that you also have to edit Magento\Catalog\Model\Category\DataProvider::getFieldsMap(). In order to do that we have to overwrite it via di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\Category\DataProvider" type="Vendor\Module\Model\Category\DataProvider" />
</config>

In the module's own data provider you have to add the attribute in the function. And then it works.

So here are my questions:

I don't think that you really have to overwrite this data provider to make it work, there must be a better way
There are 3 places inside the code where you have to declare the new attribute (setup script, ui component, data provider), I can't believe that this much overhead is necessary?
Why do you have redundant information for the attribute? For example the label is inside the setup script AND the ui component where as the label in the backend will be read from the ui component declaration.


texts: Unknown date format, neither date nor time in 'yyyy-MM-dd HH:mm:ss' found Magento1

texts:
I'm getting below error for my magento1 site.

Unknown date format, neither date nor time in 'yyyy-MM-dd HH:mm:ss' found

I have followed below article but it is not working, article comment shows that it is not the right answer.

https://kuldeepdeveloper.blogspot.com/2016/08/magento-unknown-date-format-neither.html

The issue is in \lib\Zend\Locale\Format.php on line 827 but I don't know how to solve it. If I remove this code it work for some pages.

$day   = iconv_strpos($format, 'd');
$month = iconv_strpos($format, 'M');
$year  = iconv_strpos($format, 'y');
$hour  = iconv_strpos($format, 'H');
$min   = iconv_strpos($format, 'm');
$sec   = iconv_strpos($format, 's');


texts: Magento admin login Invalid Form Key. Please refresh the page in Ubuntu

texts:
I have work with Magento 1.9.2.4 in Ubuntu OS, my one of the colleagues work with the same project in Window 7 OS,i am newly configured my project in Ubuntu OS

when i login via the backend it show me the error "Invalid Form Key. Please refresh the page".

But for my colleagues its working well.

My localhost URL :
1) localhost/workspace/magento/index.php/admin
2) mylocalip/workspace/magento/index.php/admin

When i use the second link for admin login there is no issue, but with the first link only throw the error.

For your more information, i was installed the apache2,PHP,Mysql and phpmyadmin.

Thanks advance for your idea.


texts: How can I style the CSS of ONLY the Reward Points page?

texts:
I'm fairly new to Magento. My current version is Enterprise 1.11.2.0  I was wondering how can I style the CSS of ONLY the Reward Points page?
Any help is appreciated! ive also attached a screenshot of the page I'm looking to edit.


texts: Magento2.3 add custom phtml files to footer

texts:
I have a Magento 2.3 website that has a child theme of Luma setup and bootstrap added. What I want is to in the footer is to call in a customfooter.phtml file so I can setup the footer to be a 4col layout.
then under the footer and full page width I am trying to add a new div that would call in a footer-links.phtml file and load right before the closing body tag and outside the page wrapper.

My issue is the default.xml does not see to work even though I recompiled and deployed and cleared cache.

Here is my default.xml file

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
            <arguments>
                <argument name="css_class" xsi:type="string">header links</argument>
            </arguments>
        </block>
    </referenceContainer>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_img_width" xsi:type="number">148</argument>
            <argument name="logo_img_height" xsi:type="number">43</argument>
        </arguments>
    </referenceBlock>

    <block class="Magento\Framework\View\Element\Template" name="customfooter" template="Magento_Theme::html/custom/customfooter.phtml" />

    <!--this is use for remove default elements -->
    <referenceBlock name="copyright" remove="true"/>
    <referenceBlock name="report.bugs" remove="true"/>

    <referenceBlock name="switcher-store" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="form.subscribe" remove="true"/>
    <!-- Footer Elements Ends -->
</body>


texts: magento 2:How i add header.phtml file in default.xml page

texts:
I can create a header.phtml file and call in default.xml
this is my code

<block class="Magento\Framework\View\Element\Template" name="header.mini.container" template="Magento_Theme::html/header.phtml"/>

this is my code
and header position is mytheme/magento_theme/template/html/header.phtml


texts:
I want to get Custom Error Messages for invalid Promo Codes. To some extent I achieved by using this Extension
https://marketplace.magento.com/ambab-module-couponerrormessage.html,
but I need to display the error message based on store view specific (I have 5 store views).
How I need to apply Store Id in the
/V1/carts/{cartId}/coupons/{couponCode} API Call and get store view based error messages.
Thanks in advance.


texts: Can we able to get notification or any callback if any extension is Uninstalled from mangento connect manager?

texts: We are developing an extension for connect manager and we need to get notified if any users uninstalled that extension but didn't found the way How to do that, please help if there is any way to figure out the issue


texts: Magento 2 csv product import : How to escape commas in category name

texts:
I would like to import a product csv into Magento 2 through the standard admin UI. The category name contains commas Default Category/Grocery/Snacks/Fruit, Nuts, Seeds.

The (abbreviated) csv looks like this:

sku,attribute_set_code,product_type,categories,product_websites
T1L-90573,Default,simple,"Default Category/Grocery/Snacks/Fruit, Nuts, Seeds",base

The result is that the product is imported into a new category Default Category/Grocery/Snacks/Fruit and two other new categories are being created for Nuts and Seeds.

I tried selecting the Fields enclosure but this doesn't work. I've tried escaping the commas with backslashes, double quotes and single quotes.

I tried importing the product and setting the category manually through the admin UI and exporting the product, but the category in the exported csv appears as it did in my original csv. When I delete the product and try to re-import the newly exported csv, I have the same problem as described above.

I've tried changing the Multiple value separator after seeing this question which concerns how to escape commas in the additional_info field but that doesn't seem to effect how other fields are handled during import.


texts: Missing order IDs after upgrade 2.1.9 to 2.2.5

texts:
We are getting orders missing on our Magento store after upgrade 2.1.9 to 2.2.5 but payments for them appearing on Braintree.

So I don't know what happened to that missing order numbers, I have read some of the posts in Magento community and Stackexchange and they all are saying that this can happen If there is session error or the transaction was declined to the order. Because of this, the order number will not be used again.

I have checked in Braintree Payment log (/var/log/payment.log), and I can see the missing orders are available in payment.log with Braintree error message "Cannot use a paymentMethodNonce more than once."

'transaction' =>
            Braintree\Error\ValidationErrorCollection::__set_state(array(
               '_errors' =>
              array (
                0 =>
                Braintree\Error\Validation::__set_state(array(
                   '_attribute' => 'paymentMethodNonce',
                   '_code' => '91564',
                   '_message' => 'Cannot use a paymentMethodNonce more than once.',
                )),
              ),

For your information before upgrade it was working fine.


texts: csv file format for setting table rate in magento 2

texts:
I need to set special shipping cost for 1-3 business days(first 5 kg) for the states Dubai & Sharjah in UAE, but I don't know how to write it in the csv file. Do anyone know the format?

Thanks.


texts: Auto apply Coupon code already logged in customer

texts: i want to apply coupon code automatically for logged in customer when it comes view cart page .when page loaded it is automatically applied.if user is not logged in than they want to add manually for that one.


texts:
Export CSV code not working out custom module in magento 2.3.6
<?php

 namespace VendorName\ModuleName\Controller\Adminhtml\Report;

 use Magento\Backend\Block\Widget\Grid\ExportInterface;
 use Magento\Framework\App\ResponseInterface;
 use Magento\Framework\App\Filesystem\DirectoryList;

class ExportTestCsv extends
          \Magento\Reports\Controller\Adminhtml\Report\Customer
{

/**
 * Export Privilege Products report to CSV format action
 *
 * @return ResponseInterface
 * @throws \Exception
 */
public function execute()
{
    $this->_view->loadLayout();
    $fileName = 'test.csv';
    /** @var ExportInterface $exportBlock */
    $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export');
    return $this->_fileFactory->create(
        $fileName,
        $exportBlock->getCsvFile(),
        DirectoryList::VAR_DIR
    );
}

}
Uncaught Error: Call to a member function getCsvFile() on boolean in

PHP Fatal error:  Uncaught Error: Call to a member function getCsvFile() on boolean in /var/www/html/magento2/app/code/Vendorname/Modulename/Controller/Adminhtml/Report/ExportCsv.php:40\nStack trace:\n#0 /var/www/html/magento2/htdocs/vendor/magento/framework/App/Action/Action.php(108):


texts: MagePlaza Social Logins Facebook Error: Ooophs, we got an error: Authentication failed! Facebook returned an invalid user id

texts:
For some reason when I try to use the MagePlaza Social Login extension, Facebook login throws this error:

Ooophs, we got an error: Authentication failed! Facebook returned an invalid user id.

I added the correct app id and secret to the config in the admin section.

Please help!


texts: Magento 2 : Admin grid with thumbnail field

texts: I have added a custom admin grid using ui component, now I want to add a thumbnail field in the grid. Please help me to do the same..


texts: Magento 2 Repositories code generation error

texts:
When i execute this command

sudo php bin/magento setup:di:compile

Error like this

  Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 44.0 MiBPHP Fatal error:  Class 'Tutorial\Megamenu\Block\Adminhtml\Form\Element\Magento\Framework\Data\Form\Element\Image' not found in /var/www/magento_store/app/code/Tutorial/Megamenu/Block/Adminhtml/Form/Element/Image.php on line 9

  Fatal error: Class 'Tutorial\Megamenu\Block\Adminhtml\Form\Element\Magento\Framework\Data\Form\Element\Image' not found in /var/www/app/code/Tutorial/Megamenu/Block/Adminhtml/Form/Element/Image.php on line 9

And mysql error

SQLSTATE[42S02]:
Base table or view not found: 1146
Table 'magento_store.design_config_grid_flat' doesn't exist,
query was: SELECT COUNT(*) FROM `design_config_grid_flat` AS `main_table`

I try to solve this errors from

Que:-1
Que:-2 Que:-3

But my problem can not be solve.

Please help thanks in advance


texts: Create live product feed for partner site

texts:
I want to create live feed for my partner site where he can show all my products according to need.

One way is that I export products and give file but in this way he will not be display new products added on my site.

Requirement: Do I need to create xml or json api OR what I need to do to achieve this?


texts: Magento Worldpay Extension Config Instructions? - Phoenix

texts:
Does anyone have the Phoenix Magento Worldpay configuration instructions? This extension seems to have been removed from Magento Connect but is still up on GitHub.

I can't find the configuration instructions anywhere! Phoning up Worldpay didn't help much, they weren't able to help me get it working. It almost works, but not quite.

I found instructions on the old Magento Forum, but they didn't work.

Any help configuring this would be very gratefully received!


texts: How to get value of TextField Attribute in Magento 2 in .phtml?

texts:
I have created "Text Field" Attribute and configured "Yes" in "Used in Product Listing". while I am trying to retrieving value of this text field using below code it is giving me blank output.

<?= /* @escapeNotVerified */ $_product->getTestAttribute() ?>

Still not able to get value of this attribute in my product/list.phtml file.
Thanks in advance.


texts: Magento 2: Different payment methods for private and business customers

texts:
We basically want to add an additional step before checkout where the customer will choose if he/she is a private or business customer. Then we want to initiate the checkout process, but the available payment methods should depend upon the choice the customer made in the pre-checkout step.

We don't want to use different web sites for private and business customers, and the customer should not be required to register an account.

Is there any way to achieve this without building a new checkout module?


texts: How do I create a user in the backend and allow them to only view?

texts:
They are allowed to view everything but not edit anything... Is this possible?

Here's what the function looks like now, perhaps i did something wrong?

    public function preDispatch()
{
    // override admin store design settings via stores section
    Mage::getDesign()
        ->setArea($this->_currentArea)
        ->setPackageName((string)Mage::getConfig()->getNode('stores/admin/design/package/name'))
        ->setTheme((string)Mage::getConfig()->getNode('stores/admin/design/theme/default'))
    ;
    foreach (array('layout', 'template', 'skin', 'locale') as $type) {
        if ($value = (string)Mage::getConfig()->getNode("stores/admin/design/theme/{$type}")) {
            Mage::getDesign()->setTheme($type, $value);
        }
    }

    $this->getLayout()->setArea($this->_currentArea);

    Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
    parent::preDispatch();
    $_isValidFormKey = true;
    $_isValidSecretKey = true;
    $_keyErrorMsg = '';
    if (Mage::getSingleton('admin/session')->isLoggedIn()) {
        if ($this->getRequest()->isPost()) {
            $_isValidFormKey = $this->_validateFormKey();
            $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.');
        } elseif (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
            $_isValidSecretKey = $this->_validateSecretKey();
            $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Secret Key. Please refresh the page.');
        }
    }
    if (!$_isValidFormKey || !$_isValidSecretKey) {
        $this->setFlag('', self::FLAG_NO_DISPATCH, true);
        $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
        if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
                'error' => true,
                'message' => $_keyErrorMsg
            )));
        } else {
            $this->_redirect( Mage::getSingleton('admin/session')->getUser()->getStartupPageUrl() );
        }
        return $this;
    }

    $_acl_user = Mage::getSingleton('admin/session')->getUser();
    if($_acl_user &&  $_acl_user->getId()) $_acl_role_id = Mage::getSingleton('admin/session')->getUser()->getRoles();
    else
       $_acl_role_id = 0;
    if($_acl_role_id > 0)
       $_acl_role = Mage::getModel('admin/roles')->load($_acl_role_id)->getRoleName();
    else
       $_acl_role = 'None';

    if($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && (!$this->_isAllowed() || ($_acl_role == 'ReadOnlyAccess'
    && preg_match('/(add|reset|generate|save|update\delete)/' ,$this->getRequest()->getActionName()))) ) {
      $this->_forward('denied');
      $this->setFlag('', self::FLAG_NO_DISPATCH, true);
      return $this;
    }

    if ($this->getRequest()->isDispatched()
        && $this->getRequest()->getActionName() !== 'denied'
        && !$this->_isAllowed()) {
        $this->_forward('denied');
        $this->setFlag('', self::FLAG_NO_DISPATCH, true);
        return $this;
    }

    if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED)
        && !$this->getRequest()->getParam('forwarded')
        && !$this->_getSession()->getIsUrlNotice(true)
        && !Mage::getConfig()->getNode('global/can_use_base_url')) {
        //$this->_checkUrlSettings();
        $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
    }
    if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
        Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
    }

    return $this;
}


texts: If I set a special price of one simple product of configurable product then all simple price show in special price.


texts: I am getting "You are not authorized to view this page" error while checking out to Cybersource payment gateway in Magento 2

texts:
I am using Magento 2.2.6 Enterprise edition.
In that when a user checkout to order an item, the system is throwing the error (403 Forbidden)
"You are not authorized to view this page. The transaction has not been processed"
This happens only for the logged in customers.
Can anyone please help me in solving this issue?


texts: region is a required field on login page magento 2

texts:
The region is a required field on login page Magento 2

  When the customer tries to log in on-site its throw region is a
  required field error.


texts:
I'd like to be able to set some custom type of visibility to some products. I'd like these products to be just like 'Not visible individually' but to be able to add their url, in other product's descriptions.
In default magento settings, 'Not visible individually' products return 404 error, when I try to access their details page directly using url.

Is it possible to create a new type of visibility or just remove the 404 error from these kind of products?


texts: createOrderFromQuote() function not working

texts:
What is wrong with my createOrderFromQuote() function??

public function __construct()
{
    parent::__construct();

    $this->_objectId = 'id';
    $this->_blockGroup = 'quotation';
    $this->_controller = 'adminhtml_quotation';

    $this->_updateButton('save', 'label', Mage::helper('quotation')->__('Save Quote'));
    $this->_updateButton('delete', 'label', Mage::helper('quotation')->__('Delete Quote'));

    $this->_addButton('saveandcontinue', array(
        'label'     => Mage::helper('adminhtml')->__('Save And Continue Edit'),
        'onclick'   => 'saveAndContinueEdit()',
        'class'     => 'save',
    ), 1);

    $this->_addButton('createorder', array(
        'label'     => Mage::helper('adminhtml')->__('Create Order'),
        'onclick'   => 'createOrderFromQuote()',
        'class'     => 'add',
    ), 2);

    $this->_formScripts[] = "
        function toggleEditor() {
            if (tinyMCE.getInstanceById('quotation_content') == null) {
                tinyMCE.execCommand('mceAddControl', false, 'quotation_content');
            } else {
                tinyMCE.execCommand('mceRemoveControl', false, 'quotation_content');
            }
        }

        function saveAndContinueEdit(){
            editForm.submit($('edit_form').action+'back/edit/');
        }

        function createOrderFromQuote(){

                var stored_cust_id_val = document.getElementById('quote_store_id').value;
                if(stored_cust_id_val == 0) {alert('You must load a customer or save this one before creating an order.'); return false;}
                if(confirm(\"You must save this quote before turning it into an order. Are you sure this quote has been saved since your last edit?\") == false) {return false;}
                var quote_id_val = " . $this->getRequest()->getParam("id") . ";

                new Ajax.Request(
                    createOrderFromQuoteURL,
                        {
                        method: 'get', // optional
                        parameters:{
                            'stored_cust_id' : stored_cust_id_val,
                            'quote_id' : quote_id_val
                            },
                        onComplete: function(cominBack)
                            {
                            if(cominBack.responseText != 0)
                                {
                                window.location.href = 'http://www.myeverydayvalue.com/index.php/ecorps/sales_order_create/index/customer_id/' + cominBack.responseText;
                                }
                            }
                        }
                    );
        }}


texts: I am running Magento 1.9.2.0 and  Plesk server and the PHP handler is 5.3.3 and everything is working. I want to know if I an change the PHP settings on my server to 5.4 and if I will make any difference or problems?


texts: Hide empty category (and children) with no products

texts:
I have a sidebar in the homepage which displays all categories and I want to hide all categories and subcategories that are blank.

I'm using version 1.9.2 and tried Prattski but somehow it's not working. The module doesn't geshow.


texts: How to run deploy command while memory exhausted and we can't able to increase server memory limit?

texts: Sever memory exhausted while run content deploy command and sever memory can't be increase then how to run content deploy command?


texts: Magento 2 Klarna checkout with paypal express payment issue

texts:
I am using magento version 2.3.1

I get issue when I place order with Klarna checkout
using Paypal express checkout

When place order its redirect on Paypal and pay now there
after that its giving error

  PayPal gateway has rejected request. %1

on review page (https://mydomain/paypal/express/review/)

when i check payment.log showing log like that

'response' =>
  array (
    'TOKEN' => 'EC-2Y5123450M36524K',
    'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
    'TIMESTAMP' => '2019-11-28T08:02:30Z',
    'CORRELATIONID' => '6123a5f92a775',
    'ACK' => 'Failure',
    'VERSION' => '72.0',
    'BUILD' => '5312345',
    'L_ERRORCODE0' => '10730',
    'L_SHORTMESSAGE0' => 'Shipping Address Postal Code Empty',
    'L_LONGMESSAGE0' => 'The field Shipping Address Postal Code is required',
    'L_SEVERITYCODE0' => 'Error',
  ),

But i sure I have to add post code as well in shipping/billing zipcode field

I need to use Klarna checkout + paypal express payment method

any one help here, thanks in advance


texts: Magento 2 How to create admin grid using Block(.php) file?

texts:
How can we create admin grid by using Block (.php) file?
Everytime when I tried to create block via .php file, I got stuck in between and didn't find any solution.

This time I am successful in this.

So posting a question here with answer. Hope it helps you..!!


texts: Generate factory or proxy in unit tests: "ReflectionException: Class ...Factory does not exist"

texts:
As far as I understand, Factory and Proxy classes are generated on the fly by the autoloader if they do not exist yet in var/generation (see: What Triggers the Generation of a Factory in Magento 2)

But why do I get this error when referencing a new factory in a unit test?

  ReflectionException: Class
  Magento\Framework\Api\Search\SearchCriteriaBuilderFactory does not
  exist

  [...]/vendor/magento/framework/TestFramework/Unit/Helper/ObjectManager.php:161

use Magento\Framework\Api\Search\SearchCriteriaBuilderFactory;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

class SearchCriteriaTest extends \PHPUnit_Framework_TestCase
{
    public function testFactoryGeneration()
    {
        $searchCriteriaBuilderFactory = (new ObjectManager($this))->getObject(SearchCriteriaBuilderFactory::class);
    }
}

I am using the bootstrap file dev/tests/unit/framework/bootstrap.php.

Workarounds I found to generate the class:

using the real object manager (Thanks @DigitalPianism):

\Magento\Framework\App\Bootstrap::create(BP, $_SERVER)->getObjectManager()->create('\Magento\Framework\Api\Search\SearchCriteriaBuilderFactory')

run setup:di:compile (given the factory is referenced in a constructor)

But I still hope to find a clean and performant solution.

Also, not sure if related, but create() of the generated factory from the unit test object manager returns null, so I don't even have a working factory yet.


texts: How to setup AWS Amazon MQ with Magento 2?

texts:
Magento v2.3 has been added supported for ampq message queues.  I wonder how one could go about using it with AWS SQS or Amazon MQ?

Thanks


texts: How to set custom final price on product page or product listing page?

texts: In Magento 1.9, I have used  the  event catalog_product_get_final_price to set a custom final price for the product page. However in Magento 2 the price is not changing when using the same event.


texts:
In according with realease notes about magento 2 community edition I think that I can setup a standalone database for key subsystem.

  Standalone databases for key subsystems like order management, product
  management and checkout; combined with support for MySQL Cluster,
  enable Magento to scale to handle rapid growth.

But i can't find anything about this. So where I can find something about?
Is this feature for community edition (i suppose because is under release notes about magento 2 CE) ?


texts:
I made a CSV. Name: 'nl_NL.csv'

Content: You added %1 to your shopping cart.,U heeft %1 aan uw winkelwagen toegevoegd.

That as what I want to Translate in Dutch as it is not in the standard language package.

I have put this 'nl_NL.csv' in /public_html/app/design/frontend/developer/mythem/i18n

I ran
- php bin/magento setup:static-content:deploy nl_NL -f
- php bin/magento cache:clean
- php bin/magento cache:flush

Still in English.... Rest of the site is Dutch, that is also the setting in backend.

Please advise if you know what I'm doing wrong.


texts: Mageplaza_smtp module cannot be activated

texts:
everyone, I installed mageplaza_smtp module, tested the function, can send mail normally, but when I want to deactivate the problem encountered. As shown in the figure below, my configuration failed all the time, which made it impossible to save it. The log shows that curl returns a web page where I need to enter a graphical validation code to continue accessing the store. mageplaza. com address. But this is php's curl request. Has anyone ever encountered this problem? How should we solve it?

HTTP/1.1 403 Forbidden

Date: Thu, 25 Apr 2019 12:15:05 GMT

Content-Type: text/html; charset=UTF-8

Connection: close

CF-Chl-Bypass: 1

Set-Cookie: __cfduid=d1852120624c1f16ea5862f0b7af58fc71556194505; expires=Fri, 24-Apr-20 12:15:05 GMT; path=/; domain=.mageplaza.com; HttpOnly

Cache-Control: max-age=2

Expires: Thu, 25 Apr 2019 12:15:07 GMT

X-Frame-Options: SAMEORIGIN

Server: cloudflare

CF-RAY: 4cd03d8e281298d1-LAX

安全检查! | 百度云加速

body{margin:0;padding:0}

    请打开cookies。

        只差一步
        输入验证码，可以浏览 store.mageplaza.com

            <form class="challenge-form" id="challenge-form" action="/cdn-cgi/l/chk_captcha" method="get">

    访问本页面,您的浏览器需要支持JavaScript

为什么需要输入验证码?

输入验证码证明您不是机器人，输入后可以暂时浏览网站。

如何避免？

如果您使用私人电脑，可以下载杀毒软件，进行全盘扫描保证没有中毒。

如果您使用公用电脑，可以请网络管理员修正配置选项或查找病毒来源。

    云加速 Event ID: 4cd03d8e281298d1
    •
    你的IP: 61.140.180.132
    •
    帮助中心
    •
    百度云加速

  window._yjs_translation = {};


texts:
It loads somewhat,but stalls at some point. Here is the page https://cityprintexpress.com/print-shop/business-cards-3-5x2-1.html

In console I get this error

Uncaught SyntaxError: Unexpected token x in JSON at position 131
at JSON.parse (<anonymous>)
at getData (main.js:58)
at Array.map (<anonymous>)
at HTMLDocument.apply (main.js:74)
at fire (jquery.js:3232)
at Object.add [as done] (jquery.js:3291)
at jQuery.fn.init.jQuery.fn.ready (jquery.js:3542)
at jQuery.fn.init (jquery.js:2967)
at new jQuery.fn.init (jquery-migrate.js:225)
at jQuery (jquery.js:75)


texts: Product Pricing issue with custom collection and custom tier price magento2

texts:
Added 'from date' and 'to date' to Advance pricing model, ti
I am writing custom rest api's on with some custom conditions. like

$_productCollectionFactory = $this->_productCollectionFactory->create()
    ->addAttributeToSelect('*')
    //->setStoreId($storeId)
    ->addCategoriesFilter(['in' => $allCategoryIds])
    ->addAttributeToFilter('product_type', ['eq' => $productType])
    ->addAttributeToFilter('approval', ['in' => $this->productHelper->getAllowedApprovalStatus()])
    ->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
    ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
    ->addFinalPrice()
    //->addMinimalPrice()
    ->distinct(true);

List may have simple and configurable products.
How can i calculate price, special price and per off with those tier price and product main price.
Also in case of configurable there is no price or tier price with main product so in this case minimum main price from a active in_stock child product and minimum tier price from active and in_stock child product whose tier price from date <= current_date and to_date >= current_date
Below is my previous code/conditions which i added to collection is as

//price join
$_productCollectionFactory->getSelect()->joinLeft(
  array('ad' => 'catalog_product_entity_decimal'),
  "e.entity_id = ad.entity_id AND ad.attribute_id = '77' AND ad.store_id='".$storeId."'",
  [
   'product_price' => "ad.value"
  ]
);
$_productCollectionFactory->getSelect()->joinLeft(
  array('tier_price' => 'catalog_product_entity_tier_price'),
  "e.entity_id = tier_price.entity_id AND from_date <= '".$todayStartOfDayDate."' AND to_date >= '".$todayEndOfDayDate."'",
  [
   'custom_special_price' => new \Zend_Db_Expr('IF(MIN(tier_price.value) > 0, MIN(tier_price.value), "")'),
   'final_pricea' => new \Zend_Db_Expr('IF(MIN(tier_price.value) <  ad.value, MIN(tier_price.value), ad.value)'),
   'per_off' => new \Zend_Db_Expr('IF(MIN(tier_price.value) <  ad.value, ((ad.value - MIN(tier_price.value)) * 100 )/ ad.value, 0)')
  ]
);

Above code is creating issue with configurable products, its not calculating configurable child product min tier price for current date if any.
I want a solution which will work with above condition and also price sort and price layered navigation.
Any solution, idea or a common place where i can create or write custom logic will be helpful.


texts: How to create a mixin for js/modal/confirm.js

texts:
I want to create a mixin for js/modal/confirm.js but that widget returns some javascript to make it possible to create an instance of the widget instead of the widget itself.
So it returns this
// vendor/magento/module-ui/view/base/web/js/modal/confirm.js
...
    return function (config) {
        return $('

').html(config.content).confirm(config);
    };
});

instead of
// vendor/magento/module-ui/view/base/web/js/modal/confirm.js
...
    return $.mage.confirm;
});


texts: how send more item details to cart Api in Magento 2

texts:
this is postman api call

  http://praveen/Magento/rest/V1/carts/1/items

Responce is

{
        "item_id": 10,
        "sku": "lenovo",
        "qty": 1,
        "name": "lenovo",
        "price": 35000,
        "product_type": "simple",
        "quote_id": "1"
    },

Here am trying to more information in product information like new_field from database how to get it,Thank You in Advance.


texts: Showing blank page after clicking on Magento WYSIWYG editor image insert button

texts: When I click on WYSIWYG editor image insert button it is only showing a blank page. Below screen shot is for reference.


texts: How can you display the saving a customer makes from Catalog Price Rules on the Cart?

texts:
I'm trying to find out if it even possible to display the amount of savings a customer makes on the cart from any active catalog price rules.

Scenario:
We have a customer group setup which has a 25% discount catalog price rule. It shows the discounted price and original price in the catalog, but in the cart it only shows the final (discounted) price. This doesn't give any indication of what the saving is they are getting.

Is there a way to display the saving, even if it requires a module?


texts:
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
    if ( !$.isFunction( value ) ) {
        proxiedPrototype[ prop ] = value;
        return;
    }


texts: Cron not running even after re-configuring

texts:
I have an extension that I use for feeding information to an ftp. this extension uses cron to send the feed to the ftp. but now the problem is that there is no heartbeat detected and the crons are not running in magento. I performed the tasks below trying to solve the issue of crons not running.

1) I noticed crontab e was not set (linux:ubuntu). i tried to set it to run in every minute

# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command

* * * * * /bin/sh /var/www/magento/cron.sh
* * * * * /bin/sh /var/www/magento/cron.php

2) I did a sudo service cron restart

3) I went to magento admin under System > Configuration > ADVANCED > System > Cron (Scheduled Tasks) - all the times are in minutes and Changed this to generate a schedule every minute and I schedule ahead for 5 minutes.

4) The I decided to check the cron_schedule table (select job_code, executed_at, scheduled_at from cron_schedule;). But still there was not new schedule created.

5) I then went to check the syslog and I did a grep CRON then below are the results

Sep  8 17:00:01 mthe-InventSupport02 CRON[18107]: (mthe) CMD (/bin/sh /var/www/magento/cron.php)
Sep  8 17:00:01 mthe-InventSupport02 CRON[18110]: (mthe) CMD (/bin/sh /var/www/magento/cron.sh)

After performing the tasks above. The cron were not seem to be running. Is there maybe something I am missing in the setup?

Kind Regards
Mthe


texts:
How to change shipping rate in magento when check out.
i have many tried to make

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Module_CustomShippingrate>
            <module>0.0.1</module>
        </Module_CustomShippingrate>
    </modules>
    <global>
        <models>
            <module_customshippingrate>
                <class>Module_CustomShippingrate_Model</class>
            </module_customshippingrate>
        </models>
    </global>
    <!-- Default configuration -->
    <default>
        <carriers>
            <module_customshippingrate>
                <active>1</active>
                <model>module_customshippingrate/carrier</model>
                <title>Shipping Rate</title>
                <sort_order>10</sort_order>
                <sallowspecific>0</sallowspecific>
            </module_customshippingrate>
        </carriers>
    </default>
</config>

Call Of Shipping method class

public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
}


texts: Display a red or green button on frontend

texts:
I want to display a Red or Green button to my customers of our shop stocks. We have 2 attributes where we have this information (it's not a store qty stock). It are 2 similar text attributes.

I have tried this code, but it gives me an error:

if ($_product->getvoorraaduden ()):
    if($_product == '' || $_product <= 'onbekend'):
        echo $this->__('onbekend of niets');
    elseif($_product == '0'):
        echo 'Niet op voorraad';
    else:
        echo 'voldoende voorraad';
    endif;
?>

I hope you can help me please.


texts: Product POST call to Magento REST API results in 302 and redirect (Nginx)

texts:
Having an issue when POST'ing to the Magento 1.9 REST API. Magento is being served by Nginx 1.8.0 using OAuth (successfully authenticating).

My Magento rewrite config for the API looks like this:

location /api {
    rewrite ^/api/rest /api?type=rest last;
    }

Creating a product using JSON POST:
http://www.mywebsite.com/api/rest/product

The product is created successfully, but the API responds with HTTP status code 302 and sets the Location header using this function (from  app/code/core/Mage/Api2/Model/Resource.php around line 227):

                // The create action has the dynamic type which depends on data in the request body
            if ($this->getRequest()->isAssocArrayInRequestBody()) {
                $this->_errorIfMethodNotExist('_create');
                $filteredData = $this->getFilter()->in($requestData);
                if (empty($filteredData)) {
                    $this->_critical(self::RESOURCE_REQUEST_DATA_INVALID);
                }
                $newItemLocation = $this->_create($filteredData);
                $this->getResponse()->setHeader('Location', $newItemLocation);

This results in the REST client being redirected to the the new location (not what they want). The REST client is expecting a 200 response and Location of newly created resource to be returned in the headers.

I found some other posts where people experienced similar issues and suggested inserting this:

$this->getResponse()->setHttpResponseCode(202);

just after this line:

$this->getResponse()->setHeader('Location', $newItemLocation);

This partially works, but the REST client is expecting a 200, so it thinks the action has failed.

However, if I set a 200 response:

$this->getResponse()->setHttpResponseCode(200);

The API returns a 302 with the Location and redirects the REST client.

After researching, the two possible issues I think are:

Nginx rewriting issue (note: this works as expected when using Apache)
Something to do with PHP apache_request_headers

Thanks!


texts:
I am facing an issue using a slider in frontend of magento 2. Slider works perfectly at first load but gets stuck on refresh and only works after cache data of browser is cleared.

Link to website : http://www.i-ranu.com/

Herewith I have attached the images of frontend. First is the case when slider is working fine while next is when it is not. You can see the difference in the slider dots as well.


texts: GET method arabic parameters doesn't work magento 2

texts:
I'm building rest api to get products filtered by specific attribute, when I pass parameter for GET method in arabic I get

  request doesn't match any route

and when I send it using POST method it works

Update:
here is endpoint definition

<route url="/V1/Attributes/filter/:attribute" method="GET">
    <service class="\vendor\Attributes\Api\Attributes\MyAttributesInterface" method="getproducts"/>
    <resources>
        <resource ref="Vendor_Attributes::attributes"/>
    </resources>
</route>


texts: Not able to get product collection in Custom Model

texts:
I am preparing an API in which I need to get product collection in Magento 2.

I have prepared a simple API module and its working fine, now I want to get all product collection for the API I want to make. And I want this collection in my module Model class.

I have written this code in my model file:

namespace Namespace\Connector\Model;
use Namespace\Connector\Api\OdooInterface;

class Odoo implements OdooInterface
{
    protected $_productCollectionFactory;

    public function __construct(
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        array $data = []
    ) {
        $this->_productCollectionFactory = $productCollectionFactory;
        //parent::__construct($data);
    }

    public function getProductCollection()
    {
        $collection = $this->_productCollectionFactory->create();
        $collection->addAttributeToSelect('*');
        $collection->setPageSize(3); // fetching only 3 products
        return $collection;
    }
}

But it shows below error:

  .
        Fatal Error: 'Cannot access parent:: when current class scope has no parent' in '/var/www/html/magento2/app/code/Namespace/Modulename/Model/Odoo.php' on line 15

If anyone knows how to get the product collection in Custom Module Model class. Please let me know.


texts:
please help me to find out this solution
checkout payment page on  loading process then close  Paypal window  magento 2.4.1


texts: How to get the ids of the attribute or simple products on a configurable product detail page?

texts:
I am repeating the question which is already asked by someone , but its not answered.
I want to get the simple product id when size or color is clicked.


texts: I want to show a message in a  when the user is logged in under customermenu.phtml, what is the best way to do it?


texts:
How to view attribute only in one store?
My question is: How to Display attribute only in one store?
I have a multistore views. For example. How can I view dimension only on technical view but not for standart customers view?


texts: Increasing memory usage in a shell script

texts:
I'm puzzled why memory usage steadily increase over a foreach loop in a shell script I wrote for Magento to index some data. There isn't any compounding variable (arrays increasing in size, etc.) and I'm re-using the same variables in each iteration. I can't post the entire code, but here are some lines..

For each iteration of the loop, check out the below. About 0.11MB of increased usage is shown at each iteration.

$childProduct = Mage::getModel('catalog/product')->load($childId);

$searchProduct = Mage::getModel('catalog/product')->load($parentId);

$childProduct->getAttributeText($this->_mappedColorAttributeCode);

$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . Mage::getModel('core/url_rewrite')->loadByIdPath('product/'.$searchProduct->getId())->getRequestPath();

$imgUrl = (string)Mage::helper('catalog/image')->init($searchProduct, 'small_image')->resize(135);

$colorInfo = array() which subsequently get values assigned to it, then used to created a query, $q to run

$colorInfo is passed to saveOneRow() (shorten version)

public function saveOneRow($data) {
    // Check existence first
    $now = date("Y-m-d H:i:s");
    $data['created_at'] = $now;
    $q = "INSERT INTO {$this->_tableName}...";

    try {
        $this->_writeConnection->beginTransaction();
        $this->_writeConnection->query($q);
        $this->_writeConnection->commit();

    } catch (Exception $e){
        $this->_writeConnection->rollback();
        $detail = "[{$data['sku']}] failed to write";
        $this->_writeConnection->query("INSERT INTO {$this->_logTableName} (`key_value`,`detail`,`created_at`) VALUES ({$data['entity_id']},'$detail','$now');");
    }
}

Which of these could make the usage go up incrementally?


texts: Unable to select first value from dropdown in jquery

texts:
I populated the dropdown with the help of array. for example I have array with elements (ali,abid,naqvi).
Problem.....
when I clear the cache and reload the page. and first time I am unable to select first value which is "ali". but if after cache clear and page reload, I select "abid" or "naqvi" first time and then select "ali" it work fine.
in short...after page reload I cann't select first value of dropdown unless I select other values first.


texts: Override framework file vendor/magento/framework/View/Element/Html/Link/Current.php

texts:
Any one know how to override vendor/magento/framework/View/Element/Html/Link/Current.php file in M-2.3 ?

Tried:

1) Add class using XML:  failed
2) Created plugin to override the function: failed.
3) Created module and override using preference: failed
4) Created patch and override the file: failed.

Here we are overriding protected method(_toHtml()) which is not possible by plugin.

Any help would be appreciated.


texts:
I want to show two subtotal prices in the minicart. The plan is to multiply the subtotal price and print it next to the original subtotal price. The price is printed by knockout in the html file magento/vendor/magento/module-tax/view/frontend/web/template/checkout/minicart/subtotal/totals.html which looks like this:

I can't figure out where (in which file and how) data-bind="html: cart().subtotal_excl_tax" gets the subtotal. Is what I am doing trying to do possible or is there a better way of accomplishing this?


texts: Magento 2 - Compilation from source, errors during `php bin/magento setup:static-content:deploy`

texts:
I get this error when I execute php bin/magento setup:static-content:deploy:
Compilation from source: /app/design/frontend/company/fresh/web/css/source/lib/extend/amasty/mega-menu/header.less
variable @md is undefined in file /var/view_preprocessed/pub/static/frontend/company/fresh/en_US/css/source/lib/extend/amasty/mega-menu/header.less in header.less on line 22, column 20
20| }
21|
22| @media (min-width: @md) {
23|     .ammenu-menu-toggle {
24|         &:not(.-hamburger) {
25|             margin: 0 .9rem;

It says variable @md is undefined, even though it is defined:
MY_THEME\web\css\source\_extend.less
@import 'lib/variables/responsive';  // <--- it is defined here

// Amasty
@import 'lib/extend/amasty/mega-menu/header';

Evidence:
MY_THEME\web\css\source\lib\variables\responsive.less
@xs: 0;
@xs_sm: 341px;
@xs_md: 381px;
@xs_lg: 471px;
@sm: 576px;
@md: 768px;
@lg: 992px;
@xl: 1200px;
@xxl: 1500px;

MY_THEME\web\css\source\lib\extend\amasty\mega-menu\header.less
@media (min-width: @md) {
    .ammenu-menu-toggle {
        &:not(.-hamburger) {
            margin: 0 .9rem;
        }

        .ammenu-icon:before, .ammenu-icon:after {
            background: #6d6d6d;
            width: 25px;
        }
    }
}

So why is the error showing?
The compilation is still successfull, but why are the errors showing?


texts: Cache Management options disappeared after installing turpentine

texts:
Trying to setup Varnish 3.0.5 with Magento 1.9.2.4 -

Installed turpentine with modaman

So, i think i've successfully installed turpentine

But after that when i'm going to cache management no option is visible

what's wrong with installation proccess ?


texts: How to implement owl carousel in luma theme in Magento 2?

texts:
The images for the slider should be chosen in the admin panel. I am new to magento. Kindly tell me how to implement owl carousel. I don't want to use free extensions.

I included the css file link in cms_page_view.xml like this->

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <css src="Magento_Cms::css/owl.carousel.css" />

</head>
<body>
    <referenceContainer name="content">
        <block class="Magento\Cms\Block\Page" name="cms_page"/>
    </referenceContainer>
</body>

Is this correct?


texts: Is it possible to rename bundle selections in the front-end only?

texts:
I've created a bundle product with the intention of allowing a customer to select their medium from a drop-down menu: Either MP3 or a physical CD. Each is their own distinct product which are enabled but not visible. I had to edit some configs to allow downloadable products to be part of a bundle but it appears to be working fine. Currently however, it shows the product names in the drop-down menu. Is there a way to have these be overridden (in the front-end only) to, for example, "MP3" and "Compact Disk".

I could just make many products all with the name "MP3", but that would make the customer's download page look very confusing. I could also call the products "(product name) MP3" but I feel like it's not going to be the most elegant solution.

Is it possible to achieve my goal in this way (or in any way?).


texts:
I got a nice slogan for my store but I need to translate it in the other store languages. How do I change the email logo for different stores?

For example if the user has chosen english  in English storeview -> System -> Configuration -> Design and changed my email logo. But I still get the default logo. I also tried {{block type="cms/block" block_id="email-header-sales" }} to replace the header - but my complete layout got destroyed by this. If I'm using a static block for the footer, it works fine. Magento 1.9+ rwd theme. Thank you


texts: How to remove the Add to Cart button from Catalog pages in Magento 2?

texts: How to remove the Add to Cart button from Catalog pages only?


texts: magento migration from 1.9.4.1 to 2.3.2 customers exception

texts:
I'm doing migration tests from Magento 1.9.4.1 to Magento 2.3.2.

Setup: magento2, Ubuntu 18.04 php-7.2 nginx

When I try to view the list of clients I get the following exception:

https://pastebin.com/mzVQYVkQ

anyone know how i could solve?

Thank you.


texts: how to set shopping cart rules to cater buy any 2 SKUs and get the 3rd SKUs from the rule for free?

texts:
I need to create a price rule that caters buy any 2 SKUs and get the 3rd SKUs from the rule for free? I tried many conditions and actions however i cant get the rules to work properly.

I have tried to use the Buy X and Get Y free option, however it only cater to one SKU meaning that customers can only order 3 of the same SKUs to get the 3rd one free. What i want is customer can get any 3 of the SKUs listed in the condition and get the 3rd one free.

Any help is greatly appreciated.


texts: Magento 2 Page Header Add Image, Change Color

texts:
I am in my Magento_Theme Folder playing around with the _module.less file and have been trying to get it to change my background color of the header but I can't see any changes. I've cleared my cache.

I changed line 59 to:

.page-header {
        background-color: #07baba;
        border-bottom: 1px solid @border-color__base;
        margin-bottom: @indent__base;

and that did nothing. I also tried changing link 337 to add in the background color there and no results. I changed the border in 339 and nothing.

    .page-header {
        background-color: #07baba;
        border: 25;
        margin-bottom: 0;

Cleared cache etc. What am I missing?


texts: How to Edit Header Content of a Custom Theme on Magento 2.3

texts:
Please could someone help me out!

I want to edit the header content to either remove or hide the following sections:

-Compare
-The Store Switcher (ELLYANA STORE)
-The Language Selector (ELLYANA_EN ENGLISH)

I use a custom theme: Fastest Magento 2 Theme.

Thank you.


texts: How to modify email Transactional template?

texts:
I need an shipping method condition in transaction email.
It has to display 1 message for ShippingMethodA and no message for ShippingMethodB.

Im trying to do it by transactional email conditions:

{{if  order.getShippingMethod() == flatrate2_flatrate2}}

The tracking number is: {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}} Your order can be tracked here: http://www.trackitonline.ru/

{{/if}}

or with doublequotes:

{{if  order.getShippingMethod() == "flatrate2_flatrate2"}}

but the condition is always true and displays same message for all shipping methods.

What am I doing wrong?


texts: Magento2 composer update get stuck and not proceeding further

texts:
I am upgrading Magento version from 2.1.9 to latest i.e. (2.3.3).

  Steps I followed are:

composer require magento/product-enterprise-edition 2.3.3 --no-update
composer require --dev allure-framework/allure-phpunit:~1.2.0 friendsofphp/php-cs-fixer:~2.14.0 lusitanian/oauth:~0.8.10 magento/magento-coding-standard:~3.0.0 magento/magento2-functional-testing-framework:2.4.5 pdepend/pdepend:2.5.2 phpmd/phpmd:@stable phpunit/phpunit:~6.5.0 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:~3.4.0 --sort-packages --no-update

3.composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update

4.composer remove magento/module-bundle-sample-data magento/module-theme-sample-data magento/module-widget-sample-data magento/module-sales-sample-data magento/module-wishlist-sample-data magento/module-catalog-sample-data magento/module-tax-sample-data magento/module-sales-rule-sample-data magento/module-customer-sample-data magento/module-cms-sample-data magento/module-downloadable-sample-data magento/module-review-sample-data magento/module-catalog-rule-sample-data magento/module-msrp-sample-data magento/module-gift-card-sample-data magento/module-product-links-sample-data magento/module-configurable-sample-data magento/module-grouped-product-sample-data magento/module-customer-balance-sample-data magento/module-gift-registry-sample-data magento/module-target-rule-sample-data magento/module-multiple-wishlist-sample-data magento/sample-data-media magento/module-offline-shipping-sample-data magento/module-swatches-sample-data --no-update

5.composer update

The issue I am facing is that I am unable to receive any output of composer update command.

Checked log as well and found nothing.

I am unable to proceed further after this:

Loading composer repositories with package information

Updating dependencies (including require-dev)

Any idea why is it so ?


texts:
Today I've noticed an alternative syntax in a html-template in Magento 2, which I hadn't noticed before. If you take a look at the checkout/shipping template, you'll notice a syntax like:

<each if="!quoteIsVirtual" args="getRegion('customer-email')" render="" />
<each args="getRegion('address-list')" render="" />
<each args="getRegion('address-list-additional-addresses')" render="" />

<if args="!isFormInline">
    <button type="button"
            class="action action-show-popup"
            click="showFormPopUp"
            visible="!isNewAddressAdded()">

    </button>

</if>

This is changed in a commit made over a year ago, where you can see the original equivalents, but I've only seen this until just now. Is this something I missed? Is it Knockout? Something Magento specific?


texts: How to programatically import product and set images to default?

texts:
I am creating a simple product via code but struggling adding the images correctly.
The product uploads fine and also the images too, which show ok on the frontend. But the radio buttons for base, small image and thumbnail are not ticked for the default value of the product. So the products image does not show up on the front end.

The code i am using to add the image is

$product->addImageToMediaGallery($filePath, array ('image','small_image','thumbnail'), false, false);

This is a multisite store. How can i get the default values of the image to tick when the image upload is done?

Thanks for the help!!


texts: Magento image up loader is not working (403 error)

texts:
I've a weird problem with Magento. I'm not able to upload any new product images. In my Nginx error log I am seeing a 403 error for the image when uploading. The strange thing is that the images are actually in TMP folder, but they are not showing up in the admin. Another strange thing is that the older images are showing up for all the products. I've checked all my file permissions and ownership, but nothing is working.

What is wrong?


texts:
I imported several products (multi language and imported one run into the English store and one run into the German store).
Now the quantity field and the add to cart button won't show, eventhough I already tried several option for Inventory:

Manage Stock: No
Minimum Qty Allowed in Shopping Cart: 10
Maximum Qty Allowed in Shopping Cart: 100000 (use config settings)

But even if I switch to manage stock yes and put like 100 products in stocks nothing changes on the products.
I even flushed the cache.
Do I need to reindex anything?
What else could it be?

Found one more example - manage stock yes and still 2 in stock.
On the German website I can't buy it (no add to basket button) but on the English version I can buy it.
Is there another setting somewhere not at the product where this problem could come from?
The product/inventory settings for the store views are identical.


texts: Model _beforeSave observer can't save time

texts:
Synopsis

I have a date field in my admin form but when I save this date & time, I then have an observer that runs on my model _beforeSave which corrects the format for MySQL.  Although in the database and in the fields after reload, the time is missing.

Observer

<?php

require_once Mage::getModuleDir('', 'Some_Banners') . '/Model/Slide.php';

class My_Banner_Model_slide extends Some_Banners_Model_Slide
{
    public function _beforeSave()
    {
        parent::_beforeSave();

        if (preg_match('/^\d{2}([\/]+)\d{2}\1\d{4}\s+\d{1,2}\:+\d{1,2}$/', $this->getEndAt())) {
            $endDate = preg_replace('/^(\d{2}?)\/(\d{2}?)\/(\d{4}?)\s+(\d{1,2}?)\:+(\d{1,2}?)$/', '\\3-\\2-\\1 \\4:\\5:00', $this->getEndAt());
            $this->setData('end_at', $endDate);
        }

        return $this;
    }
}

Please note: when I execute the following debugging the data is correct as expected, something happens after this method before the save occurs.

if (preg_match('/^\d{2}([\/]+)\d{2}\1\d{4}\s+\d{1,2}\:+\d{1,2}$/', $this->getEndAt())) {
    Zend_Debug::dump( $this->getEndAt() );
    // Output: 13/05/2013 12:30

    $endDate = preg_replace('/^(\d{2}?)\/(\d{2}?)\/(\d{4}?)\s+(\d{1,2}?)\:+(\d{1,2}?)$/', '\\3-\\2-\\1 \\4:\\5:00', $this->getEndAt());

    Zend_Debug::dump( $endDate );
    // Output: 2015-05-13 12:30:00

    $this->setData('end_at', $endDate);

    Zend_Debug::dump( $this->getEndAt() );
    // Output: 2015-05-13 12:30:00
}


texts: Magento 2: Apache mod version not enabled/installed/allowed by host, causes 500 error on all pages due to failing .htaccess files

texts:
I created a fresh install of Magento 2.2.2 on a debian server using php7.1 and mysql 5.7.

Once files were extracted, I was unable to access the setup wizard and received 500 errors from all pages.

In order to troubleshoot the problem, I deleted the .htaccess files in order to access the setup page and install Magento. At this point, with an incorrect Apache configuration due to missing .htaccess configuration, the homepage appears as plain HTML, with CSS styles omitted. The admin login page returns a 404 error.

I replaced the .htaccess file by changing to the Magento working directory and issuing the command:

cp .htaccess.sample .htaccess

The apache error log read:

Invalid command 'php_value'

I commented out all lines of the .htaccess files containing php_value and a new error was displayed:

Invalid command '<IfVersion'


texts:
I am using this code to get the URL of the current page I am on:

<?php $currentUrl = Mage::helper('core/url')->getCurrentUrl(); ?>

Problem is, at the end of the url, there is a slash. How can I change this:

example.com/page/

To this:

example.com/page


texts: sub directory links in a site is redirecting to domain link in magento

texts:
please visit the link "steel.newtrendzonline.com".

If you click on most of the sub-directory links ,ex: links in menu bar or categories in left , its

redirecting to the domain link http://newtrendzonline.com/steel/ . It was working

fine before.

If you click on "Featured products", it's working fine.

please give me solutioin.

Thanks in Advance.


texts:
I have used the product widget to display products from a specific category on the homepage. I need to get a different sized image for the first product that gets rendered (for visual layout reasons the first product is double the size of the others).

Do you have any advice on how to achieve this? Obviously i do not want to set all the images to be the enlarged size, just the first one in the collection. I understand images sizes are now controlled using the etc/view.xml but is there a way to override this in the templates so i can count the first one and render a larger image?


texts: How implement Regex in Magento2 Using Js? I would like to place a RegEx Code in PHP code to validate a password. Example below of current code:


texts:
From:

To:

The first image has a small width and height of the tab heading.
I want to change the tab heading as like in second one.
I tried with custom less but it doesn't work out.
Any other way like using variables in _theme.less?


texts: Magento 1.9.1.0 catalog search pagination not working

texts:
I have problem regarding catalogsearch in magento 1.9.1.0. following catalogsearch.xml.

    <layout version="0.1.0">
<default>
    <reference name="footer_links">
        <action method="addLink" translate="label title" module="catalogsearch" ifconfig="catalog/seo/search_terms">
            Search Terms
            <url helper="catalogsearch/getSearchTermUrl" />
            <title>Search Terms</title>
        </action>
        <action method="addLink" translate="label title" module="catalogsearch">
            Advanced Search
            <url helper="catalogsearch/getAdvancedSearchUrl" />
            <title>Advanced Search</title>
        </action>
    </reference>
</default>

<catalogsearch_result_index translate="label">
    Quick Search Form
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
    <reference name="left">
        <block type="catalogsearch/layer" name="catalogsearch.leftnav" before="-" template="catalog/layer/view.phtml"/>
    </reference>
    <reference name="content">
        <block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
            <block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
            <action method="setListOrders"/>
            <action method="setListModes"/>
            <action method="setListCollection"/>
        </block>
    </reference>
</catalogsearch_result_index>
</layout>

When I click page number 2 or next button its give Please Wait.. message but not load more product or not jump to next page.

When I set page/3columns.phtml pagination work.

Place help me for this solution..


texts: magento 2 - deploy for custom theme can not complete

texts:
never seen this one before, when I run

php bin/magento setup:static-content:deploy

it passes the luma and blank just fine but when goes to my theme and the backend, it gives only a few dots and without any errors just finishes "succesfully" but the theme have not taken all the changes in the frontend.

...........
Successful: 2856 files; errors: 0
---

.........................................................................................................................................................................................................................................................................................
Successful: 2898 files; errors: 0
---

=== Minify templates ===

Successful: 947 files modified
---

New version of deployed files: 1523872033

any ideas?


texts: Apply custom attributes inside attributes.phtml

texts:
My site has a tabs section, one that displays the product description and the other tab lists the getAdditionalData() like SKU and weight of the product.
There is a custom class that outputs the preselected options in the main product area. I would like to place those preselected option values inside of the tab list but for some reason I can't call the class from within attributes.phtml

Is there another way I should be doing this?

$_preset = $this->getLayout()->getBlockSingleton('Block_Catalog_Product_Preset');
$_option = $_preset->getOption();
$_presetData = $_preset->getPresetData($_option->getPreset());

The markup in the preset.phtml that loads the preset options is essentially the same other than $_preset-> it is $_this->

It gives me the error Call to a member function getPreset() on null
Thanks in advance for any feedback.


texts: Magento 2: Error in publishing new extesnion

texts:
I was trying to submit my extension in Magento dashboard, after submitting I get these errors.

All others are passed.

Installation & Varnish Test Results. Can anyone help in this issue. it's clean code.

Autoload error: Module 'Magento_AdminNotification' from '/var/www/html/vendor/way2enjoy/way2enjoy' has been already defined in '/var/www/html/vendor/magento/module-admin-notification'.

Any help will be great.

here is full composer.json

{
  "name": "way2enjoy/magento2",
  "type": "magento2-module",
  "version": "1.1.2",
  "description": "Make",
  "keywords": [
    "tinify",
    "tinypng",
  ],

  "homepage": "https://way2enjoy.com/developers",
  "license": "MIT",

  "support": {
    "email": "support@way2enjoy.com"
  },

  "authors": [{
    "name": "Rolf Timmermans",
    "email": "rolftimmermans@voormedia.com"
  }],

  "minimum-stability": "alpha",
  "require": {
    "php": ">=5.5.0",
    "ext-curl": "*",
    "ext-json": "*",
    "way2enjoy/way2enjoy": ">=1.5"
  },
"repositories": [
        {
            "type": "git",
            "url": "https://github.com/way2enjoy2/tinify-php.git"
        }
    ],
  "require-dev": {
    "phpunit/phpunit": "~4.0",
    "mikey179/vfsstream": "~1",
    "squizlabs/php_codesniffer": "~2.0",
    "codeception/aspect-mock": "*"
  },

  "autoload": {
    "files": ["registration.php"],
    "psr-4": {"Way2enjoy\\Magento\\": "src"}
  }
}


texts: Vendor autoload is not found. Please run 'composer install' under application root directory

texts:
Hello I get this error when i try the command install composer I get a lot of problems because I previously uninstalledd my 7.4 xampp php version and installed the 7.3.21. For some reason my Terminal doesn't see the correct version
Problem 1
- Installation request for amzn/amazon-pay-and-login-with-amazon-core-module 3.3.1 -> satisfiable by amzn/amazon-pay-and-login-with-amazon-core-module[3.3.1].
- amzn/amazon-pay-and-login-with-amazon-core-module 3.3.1 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.8) does not satisfy that requirement.
Problem 2
- Installation request for amzn/amazon-pay-module 3.3.1 -> satisfiable by amzn/amazon-pay-module[3.3.1].
- amzn/amazon-pay-module 3.3.1 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.8) does not satisfy that requirement.
Problem 3
- Installation request for amzn/login-with-amazon-module 3.3.1 -> satisfiable by amzn/login-with-amazon-module[3.3.1].
- amzn/login-with-amazon-module 3.3.1 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.8) does not satisfy that requirement.
Problem 4
- Installation request for bepic/magento-2-core-extension dev-master -> satisfiable by bepic/magento-2-core-extension[dev-master].
And so it goes on


texts: Bypass Minimum order ammount for downlodable products

texts:
It is possible in a store with 500€ minimum order ammount to set a custom cart rule that allow to bypass the minimum order for a certain type of product or a category?

I tried to set up a shopping cart rule but I can not find the right action.

Thank you


texts: I want to add on checkout page input field, how to add, about what kind of ideas? 2.0

texts: I want to add  input field on checkout page, how to add, about what kind of ideas? 2.0


texts: Magento 2 Query in custom model file not working

texts:
I am working on the Magento 2 custom model file, my table name is custom_log, then I have created the following model file in my module directory.

Test/Customlog/Model/Log.php

namespace Test\Customlog\Model;
class Log extends \Magento\Framework\Model\AbstractModel {

  protected function _construct() {
      $this->_init('Test\Customlog\Model\ResourceModel\Log');
  }

  public function getPrimeryField($field,$value) {
      $table = $this->getMainTable();
      $connection = $this->getConnection();
      $where = $connection->quoteInto("$field = ?", $value);
      $select = $connection->select()->from($table,array('id'))->where($where);
      $id = $connection->fetchOne($select);
      return $id;
  }

  public function setLogData($values) {
    $id = $this->getPrimeryField('log_type',$value['log_type']);
    if($id) {
      $log =  $this->load($id);
    }
    else {
      $log = $this;
    }
    $log->setData($values)->save();
  }
}

Test\Customlog\Model\ResourceModel\Log.php

namespace Test\Customlog\Model\ResourceModel;
class Log extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{

    public function __construct(
        \Magento\Framework\Model\ResourceModel\Db\Context $context
    )
    {
        parent::__construct($context);
    }

    protected function _construct()
    {
        $this->_init('custom_log', 'id');
    }

}

Test\Customlog\Model\ResourceModel\Log\Collection.php

namespace Test\Customlog\Model\ResourceModel\Log;
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * Define model & resource model
     */
    protected function _construct() {
        $this->_init(
            'Test\Customlog\Model\Log',
            'Test\Customlog\Mode\ResourceModel\Log'
        );
    }

}

Then, like to get save or update to the table values
instead of using the Factory pattern in a controller file, I just like to call a function inside the model and load the data by the field for an update or else create a new record.

Test/Customelog/Controller/Index/Index.php

Class Index extent ..... {
       protected $_log;

public function __construct(
    \Magento\Framework\App\Action\Context $context,
    \Test\Customlog\Model\Log $log

) {
    $this->_log = $log;
    parent::__construct($context);
}

public function execute() {

  $this->_log()->setLogData($values);
}

}


texts:
I have to give free shipping order over 1000 and zipcode range between 600001 to 600010, i am using webshop matrix rate for shipping method, in this case, shopping cart pricing rule not working free shipping, so i have to plan for do custom PHP code for giving free shipping, My condition how can i give condition like subtotal is equal or greater than 1000 and zipcode between 600001 and 600010 in

  /public_html/app/design/frontend/base/default/template/checkout/cart/shipping.phtml

How can i give free shipping using script?


texts:
I would like to get the Role of the user logged in.

I'm trying to use the \vendor\magento\module-user\Model\User.php class, but all results give me null or empty.

I'm trying to use \vendor\magento\module-authorization\Model\Role.php, but the same happens, all empty.

I have achieved getting the userName of the user logged in, which might help, with this class: \vendor\magento\module-backend\Model\Auth\Session.php

I have checked the database, and in the authoritzation_role I have:

Where the parent_id refers to the 3 roles I have created:

What am I doing wrong here? Am I calling the right classes? Is there a better way to do it?


texts:
In the table eav_attribute_option_swatch (the one that holds the swatch options for the attributes) I have about 6k records.
Some are color codes, others are paths to images and most of them are null (in the value column).
But something, somewhere, sometime, somehow, deletes them and I don't know what, where, when or how.
It one point I randomly realize that in the frontend the configurable products don't show swatches anymore and I can see a regular dropdown with the options.
The table is not completely cleared. So far when it happened, there were somewhere between 1 and 10 records remaining. I could not find anything special about these except for one. There is always a record with option_id = 0. (not sure if relevant).

The main problem is not that it happens. The problem is that I cannot reproduce it.
What I've tried so far:

Save random attributes that have or don't have swatches.
Saved the attribute with the most options (2k+). I thought it may have something to do with max post size or max input vars. This works as expected.
Delete one attribute.
Delete one option
Delete and add a swatch at the same time.
Changed the attribute type from swatch to something else.
... and back to swatch
Banging my head on the table.

None of the above helped (specially the last one).

I'm not looking for a full solution, though that would be great.
I need other examples (code or actions) that might touch the eav_attribute_option_swatch table.

Note:
I do have some 3rd party extensions installed and a few more that were developed internally. But I'm just looking for ideas here.


texts: Installation issue in magento marketplace 'page doesn't contain HIT in cache header.'

texts:
I have developed customer module in magento. When i am trying to submit in marketplace its keep giving the same error even after trying so many solutions.

Installation issue:
http://magento.dev/gear.html page doesn't contain HIT in cache header.
http://magento.dev/gear/bags.html page doesn't contain HIT in cache header.
http://magento.dev/gear/fitness-equipment.html page doesn't contain HIT in cache header.
http://magento.dev/gear/watches.html page doesn't contain HIT in cache header.
http://magento.dev/gear/bags/joust-duffle-bag.html page doesn't contain HIT in cache header.
http://magento.dev/collections/strive-shoulder-pack.html page doesn't contain HIT in cache header.
http://magento.dev/gear/bags/crown-summit-backpack.html page doesn't contain HIT in cache header.
http://magento.dev/collections/yoga-new/wayfarer-messenger-bag.html page doesn't contain HIT in cache header.
http://magento.dev/home page doesn't contain HIT in cache header.
http://magento.dev/enable-cookies page doesn't contain HIT in cache header.
http://magento.dev/privacy-policy-cookie-restriction-mode page doesn't contain HIT in cache header.
http://magento.dev/about-us page doesn't contain HIT in cache header.
http://magento.dev/customer-service page doesn't contain HIT in cache header.
http://magento.dev/gear/bags/joust-duffle-bag.html page doesn't contain HIT in cache header.
Show less

if you guys have any solution then please update.

Thanks


texts: Magento 2, $productRepository->get($sku) doesn't include product ID?

texts:
I'm using the following to load a product by SKU:

/* $this->productRepository (populated by DI) \Magento\Catalog\Model\ProductRepository */
$product = $this->productRepository->get($sku);

However, when calling $product->getData() or $product->getId(), there is no ID returned. I have looked at the \Magento\Catalog\Model\ProductRepository::get() method and it does find the ID correctly. Other data is included as expected:

Array
(
    [store_id] => 1
    [website_ids] => Array
        (
            [0] => 1
        )

    [attribute_set_id] => 9
    [type_id] => simple
    [tax_class_id] => 1
    [visibility] => 1
    [created_at] => 1459845988
    [sku] => ABC
    [name] => Some product
    [status] => 1
    [price] => 1.00
    [meta_title] => Some product
    [meta_keyword] =>
    [meta_description] =>
    [description] => Product description here
    [short_description] => Short product description here
    [size] => 4
    [stock_data] => Array
        (
            [use_config_manage_stock] => 0
            [manage_stock] => 1
            [min_sale_qty] => 1
            [max_sale_qty] => 2
            [is_in_stock] => 1
            [qty] => 1000
        )

    [related_products] => Array
        (
        )

    [cross_sell_products] => Array
        (
        )

    [up_sell_products] => Array
        (
        )

    [tier_price] => Array
        (
        )

    [tier_price_changed] => 0
)

Why does the returned Product object not include this key data?


texts: Migrate data issue from 1.9.2.4 to 2.3.5-p1 - SQLSTATE[23000]: Integrity constraint violation

texts:
I am trying to migrate magento from 1.9.2.4 version to 2.3.5-p1 with data migration tool. I have migrated settings,but now I have this issue on settings migration.
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-' for key 'EAV_ATTRIBUTE_ENTITY_TYPE_ID_ATTRIBUTE_CODE'

I already tried to check duplicates in eav_attributes table for entity_id = 4, but I cannot see any duplicate. Can you help me?


texts: How to get array value from block to view file?

texts:
Block file

namespace Training\Contactus\Block;

class Main extends \Magento\Framework\View\Element\Template
{
    protected $_formFactory;
    public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Training\Contactus\Model\FormFactory $formFactory
   )
{
    $this->_formFactory = $formFactory;
    parent::__construct($context);
}

  public function getTest()
  {
    $form = $this->_formFactory->create();
    $collection = $form->getCollection();
    return $collection;
  }
}

View file

 $coll = $block->getTest();

Getting error - Recoverable Error: Object of class AAA\BBB\Model\ResourceModel\Form\Collection could not be converted to string .

Please guide me>


texts: Breadcrumbs showing special characters on product page

texts:
I have a magento 2 site , when I search with something like this "3227 / 1025496"
on category page looks fine

while when I open the product page it shows like this

any idea?
Thanks in advance


texts: Saving a product gives SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails

texts:
When saving a product that is already existing in the description the product is giving a weird error on the database:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or

update a child row: a foreign key constraint fails (`magento`.`catalog_product_entity`, CONSTRAINT

CAT_PRD_ENTT_ATTR_SET_ID_EAV_ATTR_SET_ATTR_SET_ID` FOREIGN KEY

(`attribute_set_id`) REFERENCES `eav_attribute_set`

(`attribute_set_id`) ON DELET), query was: UPDATE

`catalog_product_entity` SET `attribute_set_id` = ?, `type_id` = ?,

`sku` = ?, `has_options` = ?, `required_options` = ?, `created_at` =

'2017-11-01 20:36:00', `updated_at` = '2017-11-03 16:48:30' WHERE

(`entity_id`=162)

What is going wrong and where can I resolve this? It is not happening for all products but just for certain products in the collection.


texts: How to add alphabets without space validation in magento?

texts:
There are validate-alpha and validate-alphanum-with-spaces classes in magento form validation .

But how to do only  validate-alpha-with-spaces ?


texts:
I have a product which is accessible using 2 URLs in frontend:

domain.com/catalog/product/view/id/9068/s/url-key/ and domain.com/url-key.html

I want to redirect default product url (/catalog/product/view/id/9068/s/url-key/ ) to URL I specified on product page (/url-key.html) to avoid duplicated content.

I know I can add a redirect in magento for this specific product, but this needs to be done for all products in the store.

Search engines optimization is enabled.

If there is no way to enable these redirects for all product, maybe there is way to disable /catalog/product/view/... URLs?


texts: How to Hide Add to cart button in Magento 2 front end without editing phtml file

texts:
I created a custom module which has option to enable / disable Add to cart button in front end , I'm trying to hide button without editing the core templates files , is there any way to implement it .

Also i tried to solve this using Observer function from my module but that's not working exactly as i needed.

Any help is appreciated , Thanks in advance :)


texts: After installing Smile ElasticSuite suggestions doesn't have links

texts: I installed elasticsuite by smile but after the installation suggestions below search bar are only list elements without any link. Do you know why this is happening?


texts: How to enable error mode on in Magento 2?

texts:
I am showing error with error number. In magento 2 we can enable error mode by uncommenting ini_set('display_errors', 1); in index.php

But I cannot found int_set in index.php of magento 2.

How we do this in Magento 2?


texts: Getting Error on Checkout in any payment method

texts:
Preconditions

Magento ver. 2.2.4
Developer mode/Production Mode

Expected result

User Should be able to pay after buying any product.

Actual result

On Any Payment Method i will get the following Error on placing an order

(An error occurred on the server. Please try to place the order again.)

UPDATE:
In Exception Log :

 [2019-06-01 07:43:12] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sequence_order_1' doesn't exist, query was: INSERT INTO `sequence_order_1` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sequence_order_1' doesn't exist, query was: INSERT INTO `sequence_order_1` () VALUES () at /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sequence_order_1' doesn't exist at /var/www/html/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

My env setting

db' => [
    'table_prefix' => 'sfgs_',
    'connection' => [
      'default' => [
        'host' => '',
        'dbname' => 'sfgs898',
        'username' => 'root',
        'active' => '1'
      ]
    ]
  ],


texts: Change 'This product is out of stock' message in Magento 2

texts:
When I list a product as out of stock and try to add it to my basket I get the message 'This product is out of stock'.

I'd like to change this message to 'This product is currently out of stock, please call store for updates'.

Can anyone suggest how this can be done in Magento 2?


texts: Magento 2 saving cookies works only on backend

texts:
I have followed this question on how to do cookies in Magento 2, and it works, except the cookie doesn't save when I'm on frontend. However it reads well on frontend if it already exists. I have tried setting the path always to '/' since it was '/admin' on backend and '/' on frontend, but it didn't help.

/**
 * Name of cookie that holds private content version
 */
const COOKIE_NAME = 'auto_currency_setter_initialized_cookie';

/**
 * CookieManager
 *
 * @var CookieManagerInterface
 */
protected $cookieManager;

/**
 * @var CookieMetadataFactory
 */
protected $cookieMetadataFactory;

/**
 * @var SessionManagerInterface
 */
protected $sessionManager;

/**
 * @param CookieManagerInterface $cookieManager
 * @param CookieMetadataFactory $cookieMetadataFactory
 * @param SessionManagerInterface $sessionManager
 */
public function __construct(
    CookieManagerInterface $cookieManager,
    CookieMetadataFactory $cookieMetadataFactory,
    SessionManagerInterface $sessionManager
) {
    $this->cookieManager = $cookieManager;
    $this->cookieMetadataFactory = $cookieMetadataFactory;
    $this->sessionManager = $sessionManager;
}

/**
 * Get form key cookie
 *
 * @return string
 */
public function get()
{
    return $this->cookieManager->getCookie(self::COOKIE_NAME);
}

/**
 * @param string $value
 * @param int $duration
 * @return void
 */
public function set($value, $duration = 2592000) //60*60*24*30 = 30 days
{
    //echo 'path: ' . $this->sessionManager->getCookiePath(); die;
    $metadata = $this->cookieMetadataFactory
      ->createPublicCookieMetadata()
      ->setDuration($duration)
      ->setPath('/')//$this->sessionManager->getCookiePath())
      ->setDomain($this->sessionManager->getCookieDomain());

    $this->cookieManager->setPublicCookie(
        self::COOKIE_NAME,
        $value,
        $metadata
    );
}

/**
 * @return void
 */
public function delete()
{
    $this->cookieManager->deleteCookie(
        self::COOKIE_NAME,
        $this->cookieMetadataFactory
            ->createCookieMetadata()
            ->setPath('/')//$this->sessionManager->getCookiePath())
            ->setDomain($this->sessionManager->getCookieDomain())
    );
}

I have created a logger when the the cookie is saving, and it logs just fine on both frontend and backend, but the cookie actually saves only on backend. Why is that?


texts:
How can i put a domain lock on my Magento extension?

I made a Magento extension and i want it to run on some specific domains and also i want encode it with Ioncube.
how to do that?


texts:
I am trying to export orders and address using the following code:

    $collection = Mage::getModel('sales/order')->getCollection();
    $collection->addFieldToFilter('store_id', 3);
    if (!$this->isAll()) {
        $collection->addFieldToFilter('updated_at', array('from' => date('Y-m-d', strtotime('-1 day'))));
        $collection->addFieldToFilter('updated_at', array('to' => date('Y-m-d')));
    }

    $addressCollection = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('*');
    $addressCollection->getSelect()->limit(1);
    $address = $addressCollection->getFirstItem();
    foreach ($address->getAttributes() as $attribute) {
        if (is_null($attribute->getAttributeID()) || is_null($attribute->getFrontendLabel()) || ($attribute->getFrontendLabel() == '')) {
            continue;
        }
        $collection->joinAttribute($attribute->getName() . '_billing', 'order_address/' . $attribute->getName(), 'billing_address_id', null, 'left');
        $collection->joinAttribute($attribute->getName() . '_shipping' , 'order_address/' . $attribute->getName(), 'shipping_address_id', null, 'left');
    }

    echo $collection->getSelect();

But my select does not contain the joined fields - the output is:

SELECT `main_table`.* FROM `sales_flat_order` AS `main_table` WHERE (store_id = '3') AND (updated_at >= '2014-04-15') AND (updated_at <= '2014-04-16')