texts: Magento 2: not able to get order details in observer

texts:
I am not able to get order details in observer using sales_order_save_before event:-

Path: - /app/code/Company/Mymodule/etc/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_category_delete_after">
        <observer name="Mymodule" instance="Company\Mymodule\Observer\Onafterdelete"/>
    </event>
    <event name="sales_order_save_before">
        <observer name="Mymodule" instance="Company\Mymodule\Observer\Onbeforesaveorder"/>
    </event>
</config>

Path:- /app/code/Company/Mymodule/Observer/Onbeforesaveorder.php

class Onbeforesaveorder implements \Magento\Framework\Event\ObserverInterface
{
    protected $_resource;

    /**
    * @var \Psr\Log\LoggerInterface
    */
   protected $_logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\App\ResourceConnection $resource
    ) {
        $this->_logger = $logger;
        $this->_resource = $resource;
    }

  public function execute(\Magento\Framework\Event\Observer $observer)
  {
    $orderObj = $observer->getOrder();
    $order = $observer->getEvent()->getOrder();

    if($order->getId()){
        $this->_logger->debug($order->getEntityId()." observer1111");
    }

    if ($orderObj->getId()){
        $this->_logger->debug($orderObj->getEntityId()." observer22222");
    }

    $this->_logger->debug("observer3333");// event is fired because I am getting this message in my log file.
    return $this;
  }
}

I am trying two way to get order ID in my code but both way is not working.

Please let me know if I am missing any thing or doing wrong as event is fired but not able to get order details in observer.


texts: Auto canceling orders that go into payment gateways, but never come back

texts:
I have this issue.

Sometimes orders go into gateways I built but are lost in the process. They just never come back with either failure or success. Is there a way I can cancel them if they are away for too long and don't come back to be processed?


texts: Manage transactional emails from the backend?

texts:
Since Magento 1.9, all transactional emails were being queue and sent with cronjob. That is really good, but what I am concern here is about is there anyway to manage them.

How and where Magento save them? I think core_email_queue serve for this one.

I tried to find which part/modules in Magento core handle this job (queueing email and setup cronjob to send). But unfortunately, I can't.

Long-live bloody poor Magento documentation!

Any help will be appreciated.
Thank.


texts: set default value of city and state in checkout page - Magento 2.0.1

texts:
I need to limit area in checkout page. I need to set only one default option for the form field in checkout page.

country: India

state: Tamilnadu

City: Chennai

I can only achieve country from Admin Store->Configuration->General->General->Country Options. Remaining things not found in dropdown.

Please anyone suggest how to set default value of State and city.


texts:
In sales transactional e-mails I cannot find out how to make magento print payment method. I have two options (cash on delivery or credit card on delivery) for customers. It's empty every time.

In back-end at the View order page I can't see it neither because there is only written Order was placed using.

How can I fix it, please?


texts: How to save file type custom option field value when you add a product in your cart?

texts:
I have been trying to create add to cart options programmatically. It's working well when i add a simple value but i cannot add any file type like any image.

I used this code to add it with order cart item.

$additionalOptions = array(array(
            'code' => 'lmc_custom_thread',
            'label' => 'Thread Color',
            'value' => "radhagobindwa Das",
            'print_value' => "radhagobindwa Das",
            'option_id' => "test",
            'option_type' => "file",
            'custom_view' => '',
            'image_path' =>  '/media/'."j2t_image_small.png",
        ));

        $item->addOption(array(
            'code' => 'additional_options',
            'value' => serialize($additionalOptions)
        ));

It's shows only value ["radhagobindwa Das"] and I want to show this image path.


texts: Configure Nginx to single MAGENTO instance for running multiple stores (domains)

texts:
I'm trying to run multi-store environment (2 websites) on single Magento instance but I can't figure it out. Looking around the net for solutions, I tried everything but it doesn't work.

The main website works fine but on the second one, I got this warning:

/var/www/vhosts/mydomain2.com/httpdocs/app/Mage.php was not found

I have Plesk + NGINX + PHP-FPM

I tried to setup multiple IP in one network card like this tutorial:
http://blog.sina.com.cn/s/blog_dbc356910101blfg.html

But with no success.

I always got this message:

/var/www/vhosts/mydomain2.com/httpdocs/app/Mage.php was not found

Your assistance is greatly appreciated.


texts: How to include multiple stylesheets and js files in Magento 2

texts: I have included a stylesheet in Magento2 through default_head_blocks.xml but now I am trying to include multiple css and js files by the same mechanism but its not happening.


texts: Changing attribute dropdown to radio buttons

texts:
I was wondering if there was any way to change the attribute display from dropdown list to radio buttons.
I know that there are extension doing this but they are very expensive for a simple feature like this that for my opinion Magento should implement itself without any extensions.

Is there any simple way to achieve that ?


texts: Magento 2 : Automatically rating for product has image

texts:
Automatically add four stars on the results page, products page, for all products that do have an image. (Use the database direct to update the stars for the SKUs that have image_count = true)

Use the image_count column in Magento to sort for products that have an image.

image_count is a boolean, 'true' or' 'false'. Any help. Thank in advance.


texts: Magento 2: Sort multilevel category collection by both level and position

texts:
I am using Magento 2.2 and I want to get a collection of categories that is made up of a number of sublevels of a specific category. How can I get this collection sorted by both level and position so it matches the Magento backend?

I am currently getting a category collection with a variable depth by using this code:

$childCategories = $this->categoryCollectionFactory->create();
$childCategories->addPathsFilter($menuItemCategory->getPath() . '/');
$childCategories->addLevelFilter($menuItemCategory->getLevel() + $this->depthLevel);
$childCategories->load();
$childCategories->getItems();

Where $menuItemCategory is the base category that is configured, and $this->depthlevel the number of sublevels that should be in the collection.

As expected this generates a nice collection of all the categories I want. Except that they are sorted by level and id, not level and position like I want. And when I apply a sort of position it does not make any distinction between the levels and I end up with a mess.

I've been playing around with the trees/nodes of Magento as they seem to offer some extra/other functionality compared with the collection. But if its possible through this way, I haven't figured out how to do it.

I keep ending up creating a collection for each separate level of categories. But that feels way too cumbersome as a solution. Also, it pretty much cancels out the whole idea of having a variable for the depth level.

I feel a solution is not too far off, but I can't seem to figure it out. If someone can point me in the right direction that would be great!


texts:
I have read different tuts about this and some say it all can be done from the admin panel, others say I have to add code in my layout and in the template files. Well, nothing works...

I created the static block from admin > CMS > static blocks with identifier home_image-center
Found the template app/design/frontend/enterprise/my_theme/template/cms/home.phtml and in the place where I want the block to stand I wrote this code:

<div>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('home_image-center')->toHtml();?>

</div>
In admin > CMS > Pages opened the page called home and in the Design tab in Custom Layout Update XML field I added this code: <block type="core/template" name="home_image-center" template="cms/home.phtml" /> between the reference tags.

I have put some text in the content of the static block, just to see whether it will be shown, but it's not. My final aim is to put that block there and make it available to have a static image or text in it, that can be changed at any time from the back-end.


texts:
I have site which is running on Magento 2.1.7 CE.

When I tried to upgrade site from admin using

System -> Tools -> Web Setup Wizard

it stop on

Step 2: Readiness Check

and showing error in Check Component Dependency : like screen-sort.

So, I search for the issue on web and every where I get solution about increase memory_limit.

And I change limit in php.ini avilable in magento root folder, And my change increase the memory_limit. See screen-sort.

After this also get same error. When I check my error.log file it showing something like this.

Error Log : PHP Fatal error:  Out of memory (allocated 484450304) (tried to allocate 20480 bytes)

Can any one help me into this,

Thanks in advance.


texts:
Okay so I want to be able to put multiple different types of products on my main page. I found this code

  {{block type="catalog/product_list" category_id="259"template="catalog/product/list.phtml"}}

It puts the products on the page but the layout is really messed up. I know I could do a bunch of css to fix it but I was hoping there was an easier way to fix it. Here are a couple screen shots to show what it looks like:

I am hoping there is an easy fix or an easier way to get this done. Either would work.
Thank You.

And yes I have looked at other issues like this on here but they all mostly seem like an easy css fix that is different than mine.

Update:
I edited the width and took out 'clear:left;' in the css to make it  fit on the same line. However they are doing a weird indent for each new product. I know i could do a "position: absolute;" and just move each one up however many pxs it takes to be even across, but that just seams like ugly coding. If anyone knows how to get this looking better I would appreciate the help.

Final Update:
The next day when I opened up the website the weird indent was not there. I do not think I did anything to fix it... But yes like Adarsh and Anshu said, column_count="" controls the amount of products on that line.


texts: Magento2 How To Update Cart Subtotal After Checkout cart page is load

texts: Does anyone know how to update cart subtotal after checkout cart page is loaded?


texts:
I want to create a file locker in Magento 2.
If i use the default \Magento\Framework\Lock\LockManagerInterface

Magento uses the database to save locks by default.
https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-lock.html

How I can use a fileLock  with a custom folder in the var folder?


texts: Magento2 Override Block - Invalid template file problem

texts:
I would like to Override Magento\Catalog\Block\Product\View\Description, but I've got:

  [2017-08-21 16:03:47] main.CRITICAL: Invalid template file:
  'product/view/attribute.phtml' in module: 'Test_Catalog' block's name:
  'product.info.sku' [] []

and detail.phtml is missing on frontend on product page.

I have done:

etc/di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\View\Description" type="Test\Catalog\Block\Product\View\Description" />
</config>

in Test/Catalog/Block/Product/View/Description:

<?php
namespace Test\Catalog\Block\Product\View;

class Description extends \Magento\Catalog\Block\Product\View\Description
{

    /**
     * @return array|bool
     */
    public function getConfigProductChild()
    {
         //function returns child products in array
    }
}

I'm using TemplateMonster Theme so I would like to use getConfigProductChild function in :

project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/templates/product/view/details.phtml

I read that I should type referenceBlock with template and Mine block but it doest works (or I did something wrong?).
Tried something like that:

in view/frontend/layout/default.xml of mine module:

 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.details" class="Test\Catalog\Block\Product\View\Description" template="Magento_Catalog::product/view/details.phtml" after="product.info.media"/>
    </body>
</page>

Instead of Magento_Catalog I tried also use TemplateMonser etc.

Do You know what's the problem?

EDIT:

path for missing pthml:

project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/templates/product/view/details.phtml

layout using details.phtml:
project/app/design/frontend/TemplateMonster/framework/Magento_Catalog/layout/catalog_product_view.xml

<body>
        <referenceContainer name="content">
            <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media">
                <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="product/view/attribute.phtml" group="detailed_info">
                    <arguments>
                        <argument name="at_call" xsi:type="string">getDescription</argument>
                        <argument name="at_code" xsi:type="string">description</argument>
                        <argument name="css_class" xsi:type="string">description</argument>
                        <argument name="at_label" xsi:type="string">none</argument>
                        <argument name="title" translate="true" xsi:type="string">Details</argument>
                    </arguments>
                </block>
                <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
                    <arguments>
                        <argument translate="true" name="title" xsi:type="string">More Information</argument>
                    </arguments>
                </block>
            </block>
        </referenceBlock>
</body>


texts: magento 2.3 . how to have 2 columns when viewing the products page

texts:
www.magshahindia.com

in this website on desktop its shows 3 column
but on mobile phone it shows product only on one column instead of it used to show products on 2 column of the page.

Please advise


texts: Identify customer group while adding products from customer account

texts:
I am making a custom module somewhat like this. This module has functionality to add products from customer account both in frontend and backend. I have created customer groups seller, general. Till now everything seems working on track, but in product grid i want to display customer name that which customer has uploaded this product, `how should i identify customer group and show its name in product grid.

Points I need to achieve:

Make a custom grid which shows customer wise product, it should look like default product grid but it should contain customer name column.

Any help would be appreciated.


texts: Contact Form Does not send email - no errors or logs

texts: am attempting to use the built-in Magento contact form. I have enabled the contact forum in the configuration as well as set all email addresses. I have login enabled. When I use the form it redirects and states that the email has been sent successfully. No errors are present in log files. The php_mail.log shows the emails being sent. A cron job is set up and enabled. I can't figure out why I am not receiving emails from the contact form? Any help is appreciated. Magento 1.9.2.


texts: New js in Magento_Checkout into custom theme

texts: Is it possible to create a new js file here or do I need to create a new component?


texts:
I want to use LESS CSS processing for theme development. Normally to implement LESS processor all you need to do is to add following lines to <head> tag in your html

<link rel="stylesheet/less" type="text/css" href="styles.less" />
<script src="less.js" type="text/javascript"></script>

In Magento I tried to add following line to my local.xml file with no luck

<action method="addItem"><type>skin_css</type><name>css/custom.less</name></action>

This is so because LESS requires rel attribute to be rel="stylesheet/less" , but magento obviously adds just rel="stylesheet" with addItem method.
I also tried to overwrite rel tag with <param>rel="stylesheet/less"</param>, but again with no result. Is there any workaround ? or any other solutions out there?
BTW. I did also find this this plugin, but this also did nothing.


texts: $this->getChildHtml('before_body_end') won't render in new page template

texts:
Magento CE 1.7.0.1

I've created a new 1column.phtml template file which I have set to be used by my templates catalog.xml file:

<!--
Product view
-->

    <catalog_product_view>
        <!-- Mage_Catalog -->
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>

After that I proceeded to test a few changes but I noticed that not everything was being loaded in my browser window. It seemed to stop immediately after the footer so I view the rendered page source in my browser and I see that my page stops rendering immediately before:

<?php echo $this->getChildHtml('before_body_end') ?>

The page will load without any problems if I remove that line. I check in the log files of Magento and I see nothing. I check what I believe to be the php error log for the site and I see nothing there as well. Any theories as to why Magento would stop when asked to getChildHtml? Thank you.


texts: Magento2 Set theme programmatically and not in InstallData

texts:
I have a requirement where Customer can select from available theme to be shown when they are logged in. Now I have theme's id in customer Eav setup custom attribute, I also have setup a customer_login event

events.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  <event name="customer_login">
    <observer name="themepick_customer_login_observer" instance="Afnam\ThemePick\Observer\CustomerLogin" />
  </event>
</config>

and in Observer\CustomerLogin.php

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $customer_id = $observer->getEvent()->getCustomer()->getId();
    $customer = $this->customerRepository->getById( $customer_id );

    $id = $customer->getCustomAttribute( Constants::SELECTED_THEME )->getValue();

    $themes = $this->collectionFactory->create()->loadRegisteredThemes();
    foreach ($themes as $theme) {
      if ($theme->getId() == $id) {
        $this->config->assignToStore(
          $theme,
          [Store::DEFAULT_STORE_ID],
          ScopeConfigInterface::SCOPE_TYPE_DEFAULT
        );
      }
    }

  }

but it doesn't change the theme as expected, I have followed this link https://magento.stackexchange.com/a/140027/26896 and they are changing theme in InstallData

Another important issue is that I dont really want to change the system theme I rather want to apply different themes for different users So it doesn't change the theme for all users but the current user only, and once they logout or check site in other browser with other user so they see default or other assigned theme to that user, Hope I have made myself clear


texts: Magento 2 sales_order_save_after doesn´t trigger when edit order in admin

texts:
I had configure a observer to listen the event sales_order_save_after when the order changes its status.

In Vendor/Module/etc/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_save_after">
        <observer name="<observer_name>" instance="<Vendor>\<Module>\Observer\OrderPlace" shared="false" />
    </event>
</config>

When the user create the order in checkout the observer workds fine. But when the administrator change the order in admin, the observer is ignored. I tried copy the file Vendor/Module/etc/events.xml to Vendor/Module/etc/adminhtml/events.xml but nothing change.

What could it be?


texts: Magento 1 : Category page not shown in admin

texts:
On the Magento-Dashboard under Catalog > Manage Categories is shown only the left colom with the already created categories.

But I can't create new one or modify the existing ones. Take a look at the Picture and you will understand my problem

Below, the image of the page with the error: Catalog > Manage Categories


texts: How does magento calculate tax with coupons?

texts:
I know there is a bug in magento about tax. I'm not looking into solving that. I just want to understand how it calculates and why it fails to do the calculation correctly so that I can replicate it in my module and get the prices match.

Row Total $39.75

Subtotal    $45.00
Shipping & Handling $7.95
Discount (10percent)    -$4.50
Tax $8.08
Grand Total $48.44
Total Paid  $48.44

When in fact it should be 48.45

Thanks!


texts: Magento 2 config CDN for specific file type only

texts:
Magento 2 allow to add another url for static views file, but all static file types will be requested to this url.

I want to some only file types be served using that url. Example *.js and *.css files are served via CDN, and all other file type are served from my server. Is that possible?

If I get it right, require.js is using baseUrl on very beginning of each pages to resolve static url, so may be I can 'tweak' it?


texts: How to edit navbar ( I like to show only category pics in dropdown menu)

texts:
I am using Magento 1.9. I want to show only category pics in the navigation bar (Dropdown menu).

How can I show pictures just like in below pic?


texts: Add custom block under long description (product.info.description)

texts:
I'd like to add a custom block in description tab just after long description field.

I Tried

<referenceBlock name="product.info.description">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.subdescription" template="product/view/subdescription.phtml" />
</referenceBlock>

but it did not work.


texts: Preventing fraudulent credit card authorization attempts - carding

texts:
What are some solutions for preventing fraudulent credit card authorization attempts?

Magento captcha no longer seems to do anything and attempts with several reCaptcha modules has not worked either.

Most fraud prevention tools seem to alert of potential fraud, but not prevent repeated bot attempts.


texts: where can i get that saveShippingMethod in Js

texts:
where can i get that save Shipping Method i am on order review page while making payment via pay pal i am not able to find that method . i am getting the below response on my console

POST XHR  http://www.testdomain.com/paypal/express/saveShippingMethod/

Response :
isAjaxtrue
shipping_method freeshipping_freeshipping


texts: Magento 2 How to Update current cart subtotal and grand Total?

texts:
Hello please help me to sorted out the issue

I need to update Grand Total and Subtotal of the current cart using observer in magento 2 please let me know how to do this!!!

I need cart item price total in Grand Total and Subtotal please give me step by step execution!!!


texts: Homepage - blank screen, Admin - The page isn’t redirecting properly

texts:
After changing mode Magento homepage shows blank screen, and admin - The page isn’t redirecting properly

There are no errors in reports or exception log.

In system.log:

Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []

Switched mode back - but problem remains

Also when I try enable/disable modules I got this error:

[Magento\Framework\Exception\FileSystemException]
The file "/composer.json" doesn't exist


texts: Where to add Google tag manager script code for magento2 file path?

texts: I  add to google tag manager script code but where to add file path I don't know. Can you please tell me the file path in magento2?


texts: How to hide add to cart (ajax) off grid/product page?

texts:
Looking for a fix on requiring login for 1.9 with porto theme. I've checked the standard feature listed on many places on how to hide via login but it seems like my lists.phtml format is different since ajax is built in the coding?

Example of the coding on my file,

<?php if($product->isSaleable()): ?>
    <?php  if ( !($product->getTypeInstance(true)->hasOptions($product)/*$_product->getData('has_options')*/ || $product->isGrouped()) ) :  ?>
        <a href="<?php if(!Mage::getStoreConfig("ajaxcart/addtocart/enablecategory", $code) && !Mage::getStoreConfig("porto_settings/category/qty_field", $code)): ?><?php echo $this->getAddToCartUrl($_product) ?><?php else: ?>javascript:void(0)<?php endif; ?>" class="addtocart" title="<?php echo $this->__('Add to Cart') ?>" <?php if(Mage::getStoreConfig("ajaxcart/addtocart/enablecategory", $code)):?>onclick="setLocationAjax(this,'<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId(); ?>')"<?php elseif(Mage::getStoreConfig("porto_settings/category/qty_field", $code)): ?>onclick="document.getElementById('addtocart_form_<?php echo $_product->getId(); ?>').submit()"<?php endif; ?>>&nbsp;<?php echo $this->__('Add to Cart') ?>
    <?php else : ?>
        <a href="<?php if(Mage::getStoreConfig("ajaxcart/addtocart/enablecategory", $code)):?>javascript:showOptions('<?php echo $_product->getId()?>')<?php else: ?><?php echo $this->getAddToCartUrl($_product) ?><?php endif; ?>" class="addtocart" title="<?php echo $this->__('Add to Cart') ?>">&nbsp;<?php echo $this->__('Add to Cart') ?>
        <a href='<?php echo $this->getUrl('ajaxcart/index/options',array('product_id'=>$_product->getId()));?>' class='fancybox' id='fancybox<?php echo $_product->getId()?>' style='display:none'>Options
    <?php endif;?>
<?php else: ?>
    <a href="javascript:void(0);" class="addtocart outofstock" title="<?php echo $this->__('Out of stock') ?>"><?php echo $this->__('Out of stock') ?>

Adding the default Mage::getSingleton('customer/session')->isLoggedIn() with additional lines just fails to load my page.

Any advice?


texts: Cache aware display of "product is new" badge

texts:
This is a follow up of

Magento2 : How to show New label in product list page

If I understand the proposed solution correctly, the product will still be shown as new as long as the full page cache does not expire.

What is an elegant solution for this?

I have something like the following in mind:

Detect somehow if product is no longer new (for example a cron that runs once a day, detect if the current day is just product-is-new-until plus one) or cache the latest state of product-is-new
If the product is now longer new, clear the product related cache tag.

Would that work? Did anybody do something like this, yet?


texts:
I've been trying to figure out how to add links to the top navigation for Magento 2.

In 1.x we'd just URL rewrites, however, that doesn't seem to work in Magento 2.x at this point. I added a new category Home. Then, I went to: Marketing > URL Rewrites, and edited the URL rewrite (changing the Redirect Type to 301) and saved it. Next, I clicked Add URL Rewrite, type Custom and used request path of "catalog/category/view/id/23" and target path /. I tried the redirect type as none and 301.

Is this done differently in Magento 2? Or is there another way to add links to the top navigation menu ? My problem is, I don't just need to add one link, I need to add multiple links, and they need to be drop-downs.


texts: Add a custom field's in registration form with relationship

texts:
I need a little help ..

I need to create a new field in the registration form, and this field needs to be dynamic.

I enter the panel and add the options that I want to appear in this form, and in the registration page the user chooses one of this information.

I need 2 tables to make this query, just by business rule.

Can someone help me?


texts:
I have limited the max qty of one of my products to 3. If i try to put 4 of this product in my cart it just shows me a 404 error. I can't find why it does behave like this.

I'm validating the qty option now but this only works for the first time.
So if the user puts 2 in his cart, comes pack and puts 2 more he gets the 404 error.

Changing the validation in reaction to products in cart directly on the product detail page isn't an option because of the redis cache we use.

Thanks in advance!


texts: Magento2 override module-ui base admin template file?

texts:
i want to override following file in my custom module so that when magento admin sales grid renders this template from vendor it would take file from my module:

vendor\magento\module-ui\view\base\web\templates\grid\listing.html

Can anyone let me know how to achieve this?I have tried with requirejs-config.js mapping but its not working anymore


texts: Can i configure "New", "Sale" and "IN STOCK" from admin panel ?

texts: So.. can i configure these options somewhere in admin panel ? perhaps theme settings.. or ?


texts: Magento 2: Set Customer Account Confirmation Status

texts:
Following Problem.

I get customers with an interface in to my Magento 2.1.

They are stored with a placeholder email. In my controller I update the mail address and want to set confirmation, so that the customer has to confirm his email on login.

$customer->setEmail($email);
$customer->setConfirmation(true);
//$customer->setConfirmation("Random-string"); //Did not work too
$this->_customerRepository->save($customer);

The email is updated but the confirmation flag is still NULL in the DB. How can I update it?


texts: How load phtml of custom module in magento with block on controller

texts:
I need to know how to load phtml on custom module...

I need to load phtml file on my blocks...in magento

my code is bellow.....I m creating module for my learning

purpose .....

what is the best way to load phtml in custom block...

And if I have model,controller like other mvc...

then what is the need of block in magento..

my controller
-----------
class Packt_New_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
echo "this is my new controller ";
}
    public function newAction(){

        $this->loadLayout();
        $this->renderLayout();

    }

}

my config.xml
----------------
<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <!-- module configuration -->
    <modules>
        <Packt_New>
            <version>0.0.1</version>
        </Packt_New>
    </modules>
    <!-- module configuration end -->
    <global>
        <blocks>
            <new>
                <class>Packt_New_Block</class>
            </new>
         </blocks>
         <helpers>
            <new>
                <class>Packt_New_Helper</class>
            </new>
        </helpers>
        <models>
            <new>
                <class>Packt_New_Model </class>
            </new>
        </models>
    </global>
    <frontend>
        <routers>
            <new>
                <use>standard</use>
                <args>
                    <module>Packt_New</module>
                    <frontName>new</frontName>
                </args>
            </new>
        </routers>
        <layout>
        <updates>
            <new>
                <file>new.xml</file>
            </new>
        </updates>
        </layout>
    </frontend>

</config>

my layout.xml
---------------------
<?xml version="1.0" encoding="UTF-8"?>
<layout>
   <!-- <default>
        <remove name="header"/>
    </default>-->
    <new_index_new>
        <refrence name="root">
            <action method="setTemplate">
                <template>page/2columns-right.phtml</template>
            </action>
        </refrence>
        <refrence name="content">
            <block type="new/newproducts" name="block_newproducts" template="new/new.phtml"></block>
        </refrence>
    </new_index_new>
</layout>

this is my block
-------------------
class Packt_New_Block_Newproducts extends Mage_Core_Block_Template
{

}


texts:
I found one free theme and I want to install it on my server, I follow this steps but the theme is not available in the Magento admin Content > Design > Configuration.

1. Create a folder {Magento root}/app/design/frontend/CzoneTech
2. Extract the contents of the zipped folder inside it.

So now my directory structure is look like:

what I need to do next? or what is wrong?

I run php bin/magento s:s:d and this is the output of the command:

 [Magento\Framework\Exception\LocalizedException]
  NOTE: Manual static content deployment is not required in "default" and "de
  veloper" modes.
  In "default" and "developer" modes static contents are being deployed autom
  atically on demand.
  If you still want to deploy in these modes, use -f option: 'bin/magento set
  up:static-content:deploy -f'

And for php bin/magento setup:upgrade the output is:

Nothing to import.
Please re-run Magento compile command. Use the command "setup:di:compile"


texts:
I'm trying to add a custom table for a module. The following code sits the Setup folder of my module:

<?php

namespace tivol\storeAvailability\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;

class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
    $installer = $setup;
    $installer->startSetup();

    // Get tivol_storeavailability table
    $tableName = $installer->getTable('tivol_storeavailability');
    // Check if the table already exists
    if ($installer->getConnection()->isTableExists($tableName) != true) {
        // Create tivol_storeavailability table
        $table = $installer->getConnection()
            ->newTable($tableName)
                        ->addColumn(
                            'id',
                            \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                            null,
                            ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
                            'Id'
                        )
                        ->addColumn(
                            'label',
                            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                            null,
                            ['default' => null, 'nullable' => false],
                            'Name'
                        )
                        ->addColumn(
                            'value',
                            \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                            null,
                            ['default' => null, 'nullable' => false],
                            'Stores'
                        );
            ->setComment('News Table')
            ->setOption('type', 'InnoDB')
            ->setOption('charset', 'utf8');
        $installer->getConnection()->createTable($table);
    }

    $installer->endSetup();
}
}

when I run it I get the following error on the frontend:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table
  'magento.tivol_storeavailability' doesn't exist, query was: SELECT
  main_table.* FROM tivol_storeavailability AS main_table

Any ideas as to why the table is not being created


texts: how to save ui htmlcontent input fields in product save/edit form

texts:
i have added some fields in my product form using htmlcontent like below:
    <htmlContent name="properties" sortOrder="20">
        <argument name="data" xsi:type="array">
            <item name="wrapper" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Properties</item>
                <item name="collapsible" xsi:type="boolean">true</item>
                <item name="opened" xsi:type="boolean">true</item>
            </item>
        </argument>
        <settings>
            <wrapper>
                <canShow>true</canShow>
                <componentType>fieldset</componentType>
            </wrapper>
        </settings>
        <block name="properties" class="Offer\CedProductFastEntry\Block\Helper\Form\Properties" template="Offer_CedProductFastEntry::product/properties.phtml">
            <arguments>
                <argument name="config" xsi:type="array">
                    <item name="parentComponent" xsi:type="string">product_form.product_form.block_properties</item>
                </argument>
            </arguments>
            <block as="content" class="Offer\CedProductFastEntry\Block\Product\Edit\FastEntry" name="fast-entry" template="Offer_CedProductFastEntry::product/edit/slideout/fastentry_form.phtml" />
        </block>
    </htmlContent>

in the htmlContent i create some input fields and i want to save them.
however they are not exists in form post request and i cant recieve them in server side! how can is bind them to product form? (i dont want to use ui field and fieldset, so don't change the htmlContent to field and fieldset)


texts: Can Magento Connect be removed from an installation without side-effect?

texts:
In our Magento installation we do not use Magento Connect, we add extensions manually and use git for version-controlling our installation and its extensions.  We've blocked all access to Connect via .htaccess, but it would be nice to fully remove it.

Would there be side-effects to removing the entire downloader/ folder, aside from a broken System menu link (which of course can be removed)?


texts: How to get cart info using user_id or mail_id in magento custom coding?

texts:
I try  user_id throw get cart detail my code is below but get o/p only array() not display array value give me suggestion

error_reporting(0);
include("../app/Mage.php");
umask(0);
// Initialize Magento
Mage::app();
$user_id=$_POST['user_id']."1";
$customerData = Mage::getModel('customer/customer')->load($user_id);
//print_r($customerData);
//echo $customerData->getId();
$customer_email=$customerData->getEmail();
$customer_detail = Mage::getModel("customer/customer");
$customer_detail->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer_detail->loadByEmail($customer_email);
$storeIds = Mage::app()->getWebsite(Mage::app()->getWebsite()->getId())->getStoreIds();
$quote = Mage::getModel('sales/quote')->setSharedStoreIds($storeIds)->loadByCustomer($customer_detail);
if ($quote) {

$productsResult = array();
foreach ($quote->getAllItems() as $item) {

   echo  $product = $item->getProduct();
    $productsResult[] = array(// Basic product data
        'product_id' => $product->getId(),
        'sku' => $product->getSku(),
        'name' => $product->getName(),
        'set' => $product->getAttributeSetId(),
        'type' => $product->getTypeId(),
        'category_ids' => $product->getCategoryIds(),
        'website_ids' => $product->getWebsiteIds()
    );
}
print_r($productsResult);
}


texts: How add image to sales_order_grid in magento 2

texts:
I need to add custom image into sales_order_grid for each order.

when checkout, I need to get custom image and stored to sales_order_grid for each order.

I know add custom column to sales_order_grid and sales_order and save custom field value.  But i need to add Custom Image.

My question:

which column type I need to use like TYPE_TEXT, TYPE_INTEGER While create a custom column for to view Image in sales_order and sales_order_grid.
I have Custom image Full Url, how to save this value to table and viewed as a image.
How magento2 get image in catalog/product grid view.


texts:
Today I had to create new controller, checking something while registering (ajax one). But every try of reaching it ends up in login page. I have found plugin vendor/magento/module-customer/Controller/Plugin/Account.php:29 which has some empty property allowedActions. Is it blocking from dispatching my action? Is it any way to omit that/add my action to that array?

Does it comes along with vendor/magento/module-customer/etc/frontend/sections.xml?


texts: Currency doesnt change when item in cart

texts:
I am using multiple currencies on my website and works perfectly until I add an item to the cart. Once i added the cart, the currency is changed, Magento stalls and eventually times out.

I then have to clear the sessions folder and then everything is back to normal.

The currency won't change if there is an item in the cart.

I have disabled many modules but I still cant find the issue! Also increased php memory limit. The issue is somewhere in the database or the coding somewhere!

Please help as i cant expand overseas if this is not resolved!


texts: Error when try to get data from custom database

texts:
When i try to call out my block with data from my custom database, i get an error

  a:5:{i:0;s:229:"Error in file:
  "/var/www/ifp.dk/public_html/app/code/local/Puk/EmailOrder/sql/emailorder_setup/mysql4-install-0.1.0.php"
  - SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'emailorders_id' doesn't exist in table";i:1;s:972:"#0
  /var/www/ifp.dk/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(645):
  Mage::exception('Mage_Core', 'Error in file: ...')

I have just change my database from 'emailorders' to 'emailorder' but nowhere is the menthed emailorders_id eny more.

Here is the Installfile it says there a error in

<?php
$installer = $this;
$installer->startSetup();
$sql=<<<SQLTEXT
create table emailorder(
    emailorder_id int not null auto_increment,
    order_date varchar(255) not null,
    product_name varchar(255) not null,
    location varchar(255) not null,
    date_for varchar(255) not null,
    name_title varchar(100) not null,
    email varchar(255) not null,
    company varchar(255) not null,
    adress varchar(255) not null,
    zipcode varchar(255) not null,
    city varchar(255) not null,
    phone varchar(255) not null,
    comment text not null,
    order_done int not null default 0,
    primary key(emailorder_id)

);

SQLTEXT;

$installer->run($sql);
//demo
//Mage::getModel('core/url_rewrite')->setId(null);
//demo
$installer->endSetup();


texts: Change Sort Order of Edit Action Customer Grid Column

texts:
I want to move edit action column beside customer name programmatically in customer grid like this:

how to do it from custom module?

i've tried this, but still not working

app/code/Namespace/Module/view/adminhtml/ui_component/customer_listing.xml

<?xml version="1.0" encoding="UTF-8"?>

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="customer_columns">
        <actionsColumn name="actions">
          <argument name="data" xsi:type="array">
              <item name="config" xsi:type="array">
                  <item name="sortOrder" xsi:type="number">3</item>
              </item>
          </argument>
        </actionsColumn>
    </columns>
</listing>

and i change the content with this, but still not working

<?xml version="1.0" encoding="UTF-8"?>

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="customer_columns">
        <actionsColumn name="actions" class="Magento\Customer\Ui\Component\Listing\Column\Actions" sortOrder="2">
            <settings>
                <indexField>entity_id</indexField>
            </settings>
        </actionsColumn>
    </columns>
</listing>

i already delete the customer_listing in ui_bookmark table, clean+flush cache, run setup:upgrade & di:compile, but still not working


texts: Magento 2 setup:di:compile exclude folders

texts:
Is it possible to exclude folders for a Magento 2 extension to be able to support Magento 2 compile command?

Currently setup:di:compile throws errors that parent classes not found as they are loaded with special custom "require_once like" function. I would like to make things work without change everything into Magento folder structure. (Most of the codes are not Magento specific, this is why I can't place everything into standard Magento directories.)

Any idea to make it work?

UPDATE 06.10.2016.

I tracked down the whole compile process and there was only one trick what I found to exclude a folder in the extensions. It was the test folder in the module which should contain the tests...

What I tried:

Interceptor for ClassesScanner class getList method: beforeGetList

$this->classesScanner->addExcludePatterns(array(
    'anything' => array('/^' . preg_quote('pathToMagento2\app\code\Company\Module\libraries', '/') . '/')
));

Result: libraries folder were skipped by the Repositories code generation task, but stuck in the Application code generator as that exclude not applied here.

Possible solution

Intercept \Magento\Setup\Console\Command\DiCompileCommand class's getOperationsConfiguration method -> afterGetOperationsConfiguration and modify the return values which contains these excludes and add our paths... But It wasn't possible to intercept as it is a private method...


texts: Magento2: How to customize the Billing address form?

texts:
Currently there is no validation class available in phone number field.

I want to add "validate-digits" class, but I am not able to find the related file, Please help me how to do this changes so phone number only accept number only.

Thanks in advance


texts: I got this issue The following modules are outdated:

texts:
Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Dotdigitalgroup_Email data: current version - 2.5.0, required version - 2.6.1

I am using Magento "version": "2.2.7". When i move old hosting to new hosting i got this issue. My PHP version is PHP 7.1 .

How can i fix this issue? I am Beginner with Magento 2. Please some one help me. https://devmag.visibleone.net/favelady/


texts: 1.9 One Page Checkout Checkout as Guest button to continue not working

texts:
I noticed some strange behavior with Magento 1.9 using the One Page Checkout Page. When checking out and selecting the "Checkout as Guest" then clicking the "Continue" button doesn't display the next steps such as the billing, shipping, shipping method forms. The "Continue" button is unresponsive and I see the JQuery errors in Firebug.

I built the template of the RWD theme and I upgraded from 1.7 to 1.9.

What I did notice is that it is trying to load the JQuery-1.10.2.min.js file which is not at the location and it is trying to load off the base template (skin/frontend/base/default/js/lib) when I checked the files weren't there.

So I added them to the location but when I added them the entire checkout components disappears and it starts to behave strange where the attributes no longer show in the drop downs and I can't "add to the cart" from the product pages.

This is the errors I get when adding the missing JQuery-1.10.2.min.js file

I am not sure if something went wrong in the upgrade from 1.7 to 1.9 or there is a conflict with JQuery but NoConflict is enabled.


texts: magento 2 custom email template image/logo not displayed

texts:
I am custom template for Magento 2
Created two new email template in admin backend

order confirmation email template
Shipment notification email template

Both are sharing same header and footer templates.
But when I recieve email order confirmation email showing images properly and shipment notification email images are not proper.

How logo displayed:

Even I checked the email by debuging as html format I got two different image urls

https://myshopURL/static/version1536201509/frontend/namespace/module_name/en_GB/Magento_Email/logo_email.png (logo url of order confirmation & its correct)
https://myshopURL/pub/static/version1536201509/frontend/namespace/module_name/en_GB/Magento_Email/logo_email.png (logo url of shipment notification & its incorrect).

the word "pub" added extra in shipment notification email logo URL.

How these logo urls are different they share same header and footer email template?

Am I wrong somewhere?


texts: M2.2 - Get Total Image Count for All Products

texts:
I recently did a migration from M1 to M2, and with doing that, all images came along. Some products tend to have north of 10 images, and some more like 1-3.

I am trying to find a simple and fast way of getting a list of products that would say for example have more than 5 images in their image collection. I don't need to view the images or see what the simple/base/thumbnail are. I just want the total count per product.

Is there a simple SQL query or php block I could run for this?


texts:
I want to customize magento 2 checkout page.
1st: I want to display Shipping methods before order summery on checkout (shipping section) ?
2nd: I want add classes to checkout form fields on shipping page.
Anyone can suggest me any solution ? How to I can customize that ?
Looking forward to hearing from your side.
Thank You.


texts:
In the website, all patch installed manually without ssh,

Can we skip SUPEE-10497 patch and install directly SUPEE-10570 because we have already installed SUPEE-10415, SUPEE-10266

Website magento version is 1.9.2.4

Refer screenshot:- https://prnt.sc/j6as6l

Thanks,


texts: how can I get all product of a category in a custom page in magento 1.9

texts:
I have created a custom sub category page, in which I'm calling all the sub-categories, now i want to show product of each sub-categories in the same page how can I do that.

This is what I do to get my sub-categories

1 - Create a custom block "sub-category-listing"

2 - Then I have created a subcategorylist.phtml page

<?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category-
>getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();

?>

<li class="item <?=$class?>">

<a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><?php echo $this-
>htmlEscape($_category->getName()) ?>

<?php
endif;
if($categorycount == 100000){
$categorycount = 0;
echo "
\n\n
";
}
else{
$categorycount++;
}
endforeach;
endif;
?>


texts: how to register services to DI programally?

texts:
I know we can register service via di.xml, but how can we register services programally? I have lots of similar services, I'd like to register them via code instead of static xml file.
Example
{
    "state1" : {
        "type" : "state_machine",
        "marking_store" : {
            "type" : "method",
            "property" : "state1"
        },
        "supports" : [ "Magento\\Sales\\Model\\Order" ],
        "initial_marking" : "order_placed",
        "places" : [
            "order_placed",
            "processing",
        ],
        "transitions" : {
            "purchagePlate": {
                "from" : "order_placed",
                "to" : "processing"
            }
        }
    },
    "state2" : {
        "type" : "state_machine",
        "marking_store" : {
            "type" : "method",
            "property" : "state2"
        },
        "supports" : ["Magento\\Sales\\Model\\Order"],
        "initial_marking" : "pending",
        "places" : [
            "pending",
            "requested",
        ],
        "transitions" : {
            "request_document": {
                "from" : ["pending"],
                "to" : "requested"
            }
        }
    },
    "state3" : {
        "type" : "state_machine",
        "marking_store" : {
            "type" : "method",
            "property" : "state3"
        },
        "supports" : ["Magento\\Sales\\Model\\Order"],
        "initial_marking" : "pending",
        "places" : [
            "pending",
            "received",
            "dispatched"
        ],
        "transitions" : {
            "receive": {
                "from" : ["pending"],
                "to" : "received"
            },
            "dispatch": {
                "from" : ["received"],
                "to" : "dispatched"
            }
        }
    }
}

I am using Symfonfy workflow with Mangento2, Let's assume we have 3 workflow as the example above, then we will have 3 instances of workflow. Symfony workflow is too complex to configure manually, So I'd like to configure workflow programally.


texts: How to Call controller method using Ajax from a block file in Magento custom module

texts:
I want to call a method defined in controller using AJAX from my custom module's block folder .php file.

how I can do that.?


texts: Change email button color not working for magento 2 email template

texts:
i tried to change the button for account confirmation email template in my custom theme like this:

app/design/frontend/Test/mine/web/css/source/_email-extend.less

.button{
    a{
        background-color: #00A73F;
        border: 1px solid #00A73F !important;
        border-radius: 10px !important;
        -webkit-border-radius: 10px !important;
        -moz-border-radius: 10px !important;
        -ms-border-radius: 10px !important;
        &:active {
            text-decoration: none;
            border: 1px solid #00A73F !important;
            border-radius: 10px !important;
            -webkit-border-radius: 10px !important;
            -moz-border-radius: 10px !important;
            -ms-border-radius: 10px !important;
        }
        &:focus {
            text-decoration: none;
            border: 1px solid #00A73F !important;
            border-radius: 10px !important;
            -webkit-border-radius: 10px !important;
            -moz-border-radius: 10px !important;
            -ms-border-radius: 10px !important;
        }
        &:visited {
            text-decoration: none;
            border: 1px solid #00A73F !important;
            border-radius: 10px !important;
            -webkit-border-radius: 10px !important;
            -moz-border-radius: 10px !important;
            -ms-border-radius: 10px !important;
        }
        &:hover {
            text-decoration: none;
            border: 1px solid #00A73F !important;
            border-radius: 10px !important;
            -webkit-border-radius: 10px !important;
            -moz-border-radius: 10px !important;
            -ms-border-radius: 10px !important;
        }
    }
}

the button background color is successfully changed, but when i hover the button, the color back to the old color


texts: Magento 2.0 Custom system.xml, How to include external JS

texts:
I need the google maps library in my system.xml.  where should i put the inlcude files? I already created the view/frontend/requirejs-config.js file but I am not sure how to use it to render the included JS in the header.

This is how the requirejs-config.js looks like:

    var config = {
    map: {
        '*': {
            gmap:             'https://maps.googleapis.com/maps/api/js?v=3.18&libraries=geometry,places',
            gmaps:            'https://cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.22/gmaps.min.js',
            jqueryGeolocation:'https://cdnjs.cloudflare.com/ajax/libs/jQuery-Geolocation/1.0.50/jquery.geolocation.min.js'
        }
    }
};


texts: Validation error in checkout page shipping address

texts:
Here i am change city and zip code value set by jquery

but

<input class="input-text" type="text" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
attr: {
    name: inputName,
    placeholder: placeholder,
    'aria-describedby': noticeId,
    id: uid,
    disabled: disabled
}" name="city" placeholder="" aria-describedby="notice-XJCWJ1B" id="XJCWJ1B">

as per code valueUpdate by keyup so how can i update value of city and zip code without enter anything in that field using jquey?


texts: How to use Quotation mark in translation CSV Magento 2

texts:
I'm trying to change the following in a custom translation file but can't get it to work:

  "Check "Remember Me" to access your shopping cart on this computer even if you are not signed in."

to

  "Check "Remember Me" to access your shopping basket on this computer even if you are not signed in."

I have tried the following:

  "Check \"Remember Me\" to access your shopping basket on this computer even if you are not signed in."

  "Check ""Remember Me"" to access your shopping basket on this computer even if you are not signed in."

  "Check \"\"Remember Me\"\" to access your shopping basket on this computer even if you are not signed in."

It's in a csv file that has other translations in that do work


texts: Magento 2 - Order overview open how to open in a new window/tab

texts:
I've searched and searched.

What i'd like to achieve is from the order overview that the PDF is opened in a new window/tab.

Go to: Sales - Order in the admin
Select a order (Using the checkbox in the first column)
Select print invoices from the Actions dropdown menu.

Result is in the current window the invoices PDF. How can I change this to be in a new window/tab.

I think I need to make a change in the source code.
I've searched on the file system, no solution found using search so far.


texts:
How to Override Select.phtml (product/view/options/type/select.phtml) magento 2

<?xml version="1.0" ?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.form.options.select" template="Maxime_Helloworld::select.phtml"></block>
        </referenceContainer>
    </body>
</page>


texts:
I'm having issues with a clone of our production store (Mag v1.4.0.1). We cloned our production store to a staging server for testing some modifications and I cannot login to the staging server's admin portal. Please don't berate me for having such an old version, ours is heavily modified and we cannot upgrade.

We have done this many times and never had an issue. I made the required changes to the database as shown below, but I keep getting redirected to the main page of our production store. I also toally cleared the store/var/cache and store/var/session directories and made sure the store/var directory was chmod 777. We DO NOT have SSL on this server and it has never caused an issue before.

Also, the cookies are getting stored with www.scic.com and scic.com domains. I do not see any cookies with staging.cic.scic.com in them anywhere.

What am I missing???


texts: Apply Only One Discount to Multiple Items in Cart

texts: I am looking to apply the discount to only one item in the cart. For example, I have 5 SKU's that receive 25% off when they use a discount code. I have it set up where if they add 2 of Product A to the cart, the discount only applies to 1 of them. However, if they add Product B as well (another SKU that is part of the discount code) to their cart, it now is applying the discount to both products. How do I work around this? I want the 25% to work on only ONE product in the cart.


texts: Fixing all target="_blank" vulnerabilities in a website

texts:
https://dev.to/ben/the-targetblank-vulnerability-by-example

I've been reading more about this lately and would like to make sure my website(s) are secure. I assume a simple search and replace should fix the issue but though I'd come to the community to check.

I know I have used this string of code in my CMS Pages and possibly Static Blocks as well. It is probably peppered into some custom .html and .phtml pages in my design folders too. Since I can use Dreamweaver on a copy of my site to update the .(p)html files, how can I use phpMyAdmin to update the strings controlled by magento?

I'd like to change the following string from this:

target="_blank"

To this:

target="_blank" rel="noopener noreferrer"

In all CMS Pages, Static Blocks, Product Descriptions, and Short Descriptions (catalog_product_entity_text & catalog_product_flat_#) - as that is where a search is showing the most results.

Are there any issues I should be aware of? Anyone else reading this should follow the golden rule of always making a DB backup before applying any changes like this.

Thanks!


texts: Check whether product available in main website

texts:
When product is not enabled in main website from the backend is there way to find it programmatically?

I have tried this way. But it shows product id(not false)

$product       = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId);
$productIdMage = $product->getId();

if($productIdMage != false) {
    echo $productIdMage;
}
else{
    echo 'false';
}


texts: Magento Data Migration Tool claims catalog_product_entity table does not exist?

texts:
I'm upgrading from Magento 1.8.1 to Magento 2.3.3. So far, I have the data migration tools installed and the proper config.xml set with all proper configurations. I haven't touched the map.xml file, because I don't believe there are any custom mappings required in my case.

The settings migration seems to run fine and complete. However, when I run the data migration command I get the following warning and the process halts:

Below is exactly what the screenprints in text form. HOWEVER, I have triple checked and that table fully exists. I can see it in PHPMyAdmin and all the data therein. I did notice that the warning message doesn't have the table prefix specified. I, again, have triple checked this as well. I have completely specified the source and destination prefixes in the config.xml file. The source is "mage_" and the destination is "ma233". Bear in mind, it stops at integrity check step one at 58%. If it wasn't picking the prefixes up correctly, I would think it would have failed immediately on the settings migration.

Can someone please help, it would greatly be appreciated!!!

[2020-01-17 01:03:19][INFO][mode: data][stage: integrity check][step: Data Integrity Step]: started
58% [================>-----------] Remaining Time: < 1 sec
In Mysql.php line 110:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'stagingddbunlimi_store_storemagento.catalog_product_entity' doesn't exist, query was: SELECT DISTINCT  `child`.`prod_id` FROM `mage_files` AS `child`
   LEFT JOIN `catalog_product_entity` AS `parent` ON child.prod_id = parent.entity_id WHERE (child.prod_id IS NOT NULL) AND (parent.entity_id IS NULL)

In Mysql.php line 91:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'stagingddbunlimi_store_storemagento.catalog_product_entity' doesn't exist
 SQLSTATE[42S02]: Base table or view not found: 1146 Table


texts: Is there a way to get all products by a specific attribute value? For example: how can I get all the products where the attribute color is red?


texts: Magento 2: How to reindex specific ids and in specific indexer using an observer

texts:
I know I can programatically trigger the indexer to index a list of product ids with the following:

/**
 * @var \Magento\Framework\Indexer\IndexerInterfaceFactory
 */
protected $indexerFactory;

public function __construct(
    \Magento\Framework\Indexer\IndexerInterfaceFactory $indexerFactory,
) {
    $this->indexerFactory = $indexerFactory;

}

public function execute()
{
    $productIds = [1,2,3];
    $indexer = $this->indexerFactory->create()->load('catalog_product_flat');
    $indexer->reindexList($productIds);
}

But is there not a cleanest way to do this?

Something like firing and event and passing the ids that need to be reindexed.


texts:
My script :
<script>
require(['jquery'], function($){
jQuery.ajax({
url: '<?php echo $this->getUrl('customwishlist/index/wishlist') ?>',
method: 'get',
dataType: 'json',
success: function(data) {
var wislistAddesCheckData = data;
var itemLenth = wislistAddesCheckData.items.length;
for(i=0;i<itemLenth; i++){
var wislistAddedProductId = wislistAddesCheckData.items[i].product_id;
$(".product-id-"+wislistAddedProductId).attr('src','/pub/media/yt.png');
}
}
});
});
</script>

My path :
app\design\frontend\Zero\my_theme\Magento_Wishlist\templates\catalog\product\list\addto\wishlist.phtml
How to include the image path in $(".product-id-"+wislistAddedProductId).attr('src','/pub/media/yt.png');


texts:
I'm trying to get the Category URL in my Home page, I'm working in the file app/design/fronted/[package]/[theme]/template/catalog/product/widget/new/content/new_grid.phtml

I've got this code above the product title

<?php
/**
 * get categories from a product
 */
$categoryIds = $this->helper('catalog/output')->productAttribute($_product, $_product->getCategoryIds());
/**
 * looping through the array of category ids
 */
foreach($categoryIds as $categoryId) {
    $category = Mage::getModel('catalog/category')->load($categoryId);
    if($category->parent_id == 4):
?>

<a href="<?php echo $category->getUrlKey() ?>">De <?php echo $category->getName() ?>

<?php
    endif;
}
?>

Some times I use "getUrl" instead of "getUrlKey", and both give me a "404" page.
I believe the error is in some Magento configuration, not in the code.

Some one have an answer to any approach?

Thanks in advence!


texts: Configured product appears to be out of stock while it is not in Magento2

texts:
I have issue after migration Prestashop to Magento2. All Products details are migrate but Some of Configured products are show out of stock but in backend it's in stock.

Magento Version: 2.0.7

Thanks


texts: Load Container Html Wrapper Without Child

texts:
Is it possible to load a container with html tag and class without any content? From what I have seen if there are no blocks placed inside a container it does not load.

Is there a method of adding any attributes or concise content that will make it display?


texts: Magento 2 - Heavy loading time (too many js files)

texts:
I'm currently working on Magento 2 and I noticed that loading times for all the pages are extremely high.

I'm running on Xampp at the moment, production mode enabled, HTML/js/CSS are merged and minified, Varnish is disabled and I will not use it since my web hosting can't install it on my server because it will interfere with some scripts.
I use a custom theme which parent is the blank theme of Magento 2.
After changing my settings I redeployed static files and emptied the cache.

My main concern is that when I look at the network panel I see that a huge amount of js files is loaded every time.
For example on my category page, 122 js files are loaded which I found is quite a lot, for a total size of 955 ko.

I tested it on my server without the merging and minifying but as I said above, I think the issue lies with the amount of file loaded because even if it loads faster it's still too long and on the checkout process it's even worse.

I tried the bundling option but it generates an 8MB js file which is worse.

Did I miss something or is it somewhat normal that the amount of js files is this much? Is Varnish mandatory for good performance and is there an alternative to it?

I'm fairly new to Magento 2 so if you need more info I will be happy to provide it.


texts: How to Dynamic generate Open Graph protocol meta tags

texts:
<meta property="og:url" content="<?php echo "http://". $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];?>"/>
<meta property="og:description" content=""/>
<meta property="og:title" content=""/>
<meta property="og:image" content=""/>

I've tested with the head.phtml file,but I don't know how to get product attributes such like sku, color and images.

I tested with $this->helper('catalog/image')->init($_product, 'image') found in
media.phtml on meta tag and get a blank page,but images on product view are working fine.

That confuses me a lot.


texts: How to add block to bundle fieldset in Magento 2?

texts:
I am trying to add a block to the configure screen of bundled products in the create order form of admin.

I added this layout file:  My/Module/view/adminhtml/layout/catalog_product_view_type_bundle.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

        <referenceBlock name="product.composite.fieldset.bundle">
            <block class="My\Module\Block\Adminhtml\FooBar" name="product.composite.fieldset.bundle.foobar" template="My_Module::foobar.phtml" after="-"/>
        </referenceBlock>

</page>

I added this block file:  My/Module/Block/Adminhtml/FooBar.php

<?php
namespace My\Module\Block\Adminhtml;

class FooBar extends \Magento\Framework\View\Element\Template
{
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context
    ) {
        parent::__construct($context);
    }

    public function sayHello()
    {
        return __('hello');
    }
}

I added this template file:  My/Module/view/adminhtml/templates/foobar.phtml

<?php echo "
HELLO HELLO HELLO
"; ?>

And finally I clear the cache and compile:

magento c:c
magento s:d:c

But I don't see any big-ole HELLOs in the page.  What am I doing wrong?


texts: Grand Total not updated when discount code is applied

texts:
There are 2 types of Discounts (Shopping Cart Rules) Working on the Website right now:

Coupon Codes - Working Absolutely Fine BUT - Subtotal does not get Updated. Ex: 10% Off on Rs. 500 and Above - When I apply the Coupon Code, it shows perfectly before Subtotal but the Grand Total still remains the same(without discount)
Without Coupon Code Discount - Working Only On Checkout Page after I select a Payment Method. - Eg: ABC Product has a Coupon Attached to it giving Free Shipping on it BUT this is not Reflecting in My Basket Subtotal and is Only Visible in Checkout Page's Subtotal upon selecting a Payment Method - NOTE: The Subtotal where Shipping Charges are currently visible used to Show a Value of ZERO when ABC Product was added.

IMP NOTE. This Issue of Grandtotal related to Config because this was Non-Existent and suddenly popped up after Migration to a nginx Server. - The Server Admin has thoroughly verified and is sure of no errors on Server Side.
I have cross checked all Settings and Discount Rules in Backend - No Defaults found

No Tax Calculation is used on the Website

Thank You for Reading the above and I hope you, the reader would be able to contribute towards resolving this.


texts: Magento flat rate shipping with incremental product cost?

texts:
I'm trying to find an extension that will let me do the following:

Per-category (preferably) or per-product (ok) settings where flat rate shipping applies for the products in that category / product.
Enter a base rate for the first purchased item and then a different cost for each incremental item.

I am finding lots of extensions that will only let me set a single flat rate, so when you order 2 or more it just does a straight multiplication, which would be wrong in my case.


texts: Magento2 How to reduce fields from shipping calculate form in cart page

texts:
I am integrating design in Magento2 and want to remove fields from shipping calculate form like I don't want the country and state. Shipping calculates form should contain only one field i.e zipcode .customer can get shipping rate by entering their postcode.
How can I do this? We have applied all possible ways to remove country and state field. I also tried it by apply javascript for hiding country field and state field but that's also not working because of the knockout loads' template after load whole page.


texts:
I am looking for the file to edit the HTML for https://cashino.kellyseye.com/

I would like to change the static block "home-center-promotion" to display another static block.

Thanks


texts: How to create custom registration form in magento for seller

texts:
How to make a custom registration and login form for sellers in magento.
I'm using marketpalace extension , and want to make a custom registration form.


texts: How to display the sku of product in javascript?

texts:
When the below line is used in JavaScript it displays the Product Id:

var productId = optionsPrice.productId;
window.alert(productId);

Similarly how to get & display sku of the configurable product & simple product?


texts: Cannot get Custom Block to correct area on page?

texts:
I am at a loss. I am trying to learn how to place this block on the index of my site but I cannot for the life of me get it to appear in the right area but I have been following guides to no avail.

I want my block to appear under the 'New Products' within the default sample data (After Mage_Catalog_Block_Product_New) but no luck. So far I am stuck at getting the block to appear so I can then do the rest. Edit: Have it working by hardcoding but not Progmatically

What I have so far is my module SiteTest and I am using the sample data with (rwd theme)
config.xml

        <?xml version="1.0"?>
<config>
    <modules>
        <Francis_SiteTest>
            <version>0.1.0</version>
        </Francis_SiteTest>
    </modules>

    <frontend>
      <layout>
        <updates>
            <Sitetest>
                 <file>Sitetest.xml</file>
             </Sitetest>
         </updates>
      </layout>
    </frontend>

    <global>
        <blocks>
            <Sitetest>
                <class>Francis_SiteTest_Block</class>
            </Sitetest>
        </blocks>
    </global>
</config>

My Block called block.php

<?php
class Francis_SiteTest_Block_block extends Mage_Core_Block_Template
{
    // my large working method in here
}

My controller in IndexController.php

<?php
    class Francis_SiteTest_IndexController extends Mage_Core_Controller_Front_Action{
    public function indexAction(){
          $this->loadLayout();
          $this->renderLayout();
    }

    public function viewAction(){
          $this->loadLayout();
          $this->renderLayout();
    }
}

Followed up with app/design/frontend/rwd/default/template/Sitetest/block.phtml simply having my code I want executed

I expected this to render Under the New Products but I don't know where I have gone wrong. (or how badly for that matter).


texts: How to uninstall the installed extension without Magento Connect?

texts:
I installed extension by unzipping the .zip file in root folder. Now I would like to Uninstall it completely and reinstall the different version (much never version), there are huge differences in 2016 version and many more files to it than original 2013 version.

What is the proper way to uninstall extension that was installed without Magento Connect Manager?


texts: How does Magento 2 process & compress product images

texts:
Im looking for a complete explanation on how Magento 2 processes and compresses product images.

How does Magento 2 compress JPG & PNG product images?
What compression methods does it use?
Which image processing adapter setting is better, ImageMagick or PHP GD2?
Which specific files in the magento core are responsible for setting the compression levels for product images.

8 Bit PNG Images

If 8bit PNG images are uploaded they become very pixelated by Magento, with both the PHP GD2 or ImageMagick image processor configured.

I have found that in vendor/magento/module-catalog/Model/Product/Image.php the jpeg image quality is set to 80 by default.

protected $_quality = 80;

And in vendor/magento/framework/Image/Adapter/Gd2.php the quality is set to 9.

switch ($this->_fileType) {
    case IMAGETYPE_PNG:
        $quality = 9;   // For PNG files compression level must be from 0 (no compression) to 9.
        break;

Although when I change the png compression level to 0 from 9 (for testing purposes only) I see no change, even after clearing cache, flushing the catalog images and removing cached and generated directories.  With xDebug on I can confirm this line is being called, but it has no noticeable effect.

Following setting the quality, it's added to the $functionParameters which also holds the image processor adapter type, and image destination path.  Can other parameters be added.

$functionParameters = [$this->_imageHandler, $fileName];
if ($quality) {
    $functionParameters[] = $quality;
}


texts: How can i installing Magento 2 with Sample data on my windows Xampp

texts:
I successfully install Magento 2 without sample data on my windows Xampp
as following  process:

C:\Users\Matin>D:
D:\>cd D:\xampp\htdocs\magento2
D:\xampp\htdocs\magento2>
D:\xampp\htdocs\magento2>composer install

Then I install from browser as magento previous version..

Now How can i take sample data of my magento2 site.
I try to read http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.html#instgde-install-sample-intro
but Step 5 can not understandable for me

5.In the first section, add "minimum-stability": "beta", before license. A snippet follows:


texts: Magento2 - SOAP API not authorized issue

texts:
I tried to call SOAP API of Magento 2 but I could not call successfully.
Here is my source code:
require('vendor/zendframework/zend-server/Zend/Server/Client.php');
require('vendor/zendframework/zend-soap/Zend/Soap/Client.php');
require('vendor/zendframework/zend-soap/Zend/Soap/Client/Common.php');

$token = "olourdje47c5c5g66md4gfceyslo9y1p";
$opts = ['http' => ['header' => "Authorization: Bearer " . $token]];
$context = stream_context_create($opts);

$wsdlUrl = "http://mage2.dev/soap?wsdl&services=customerCustomerRepositoryV1";
$serviceArgs = array("customerId" => 1);

$soapClient = new \Zend\Soap\Client($wsdlUrl);
$soapClient->setSoapVersion(SOAP_1_2);
$soapClient->setStreamContext($context);
$soapResponse = $soapClient->customerCustomerRepositoryV1GetById($serviceArgs);
var_dump($soapResponse);

The error message shown on browser is:

Fatal error: Uncaught SoapFault exception: [env:Sender] Consumer is
not authorized to access %resources in
/vagrant/data/magento2/vendor/zendframework/zend-soap/Zend/Soap/Client.php:1118
Stack trace: #0
/vagrant/data/magento2/vendor/zendframework/zend-soap/Zend/Soap/Client.php(1118):
SoapClient->__soapCall('customerCustome...', Array, NULL, NULL, Array)
1 /vagrant/data/magento2/test_api.php(28): Zend\Soap\Client->__call('customerCustome...', Array) #2
/vagrant/data/magento2/test_api.php(28):
Zend\Soap\Client->customerCustomerRepositoryV1GetById(Array) #3 {main}
thrown in
/vagrant/data/magento2/vendor/zendframework/zend-soap/Zend/Soap/Client.php
on line 1118

The token in the source code was the access token of the integration with all resource I created on Magento back-end. The integration was active.
I could call the SOAP API without resource need successfully. For example, the Get function in the catalogProductRepositoryV1 service.
I wonder if there are any missing procedures I have to complete first for using SOAP API with resource need.
I will thank you so much for any helps.


texts:
I would edit the .htaccess file, but there only was :

Order deny,allow
Deny from all

that is normal?
This file was in the subdirectory app , in the root directory there wasn't any file


texts: Show all configurable product options in view

texts:
I'm setting up a custom configurable product screen, replacing the select boxes with radio buttons (amazon style). The thing is, I would like to display all possible options on the product view, and the default option is that Magento enables the second attribute once the first one has been set (it filters the attributes according to availability). I would like to show all options and disable them (visually by graying them out) once the user has interacted with the attributes (Think of buying sneakers on Amazon. If a color is not available for a specific size, the color is grayed out).
How can I do this?
Update:
I've toyed around for a while with configurable.js and replaced the fillSelect() function for a fillRadio() function that reads like this:
fillRadio: function(element){
    var attributeId = element.id.replace(/[a-z]*/, '');
    var attributes = this.getAttribute(attributeId);
    var options = this.getAttributeOptions(attributeId);

    var prevConfig = false;
    if(element.prevSetting) {
        prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];
    }

    if(options) {
        var index = 1;
        var inputs = [];
        for(var i = 0; i < options.length; i++) {
            var allowedProducts = [];

            var input = document.createElement('input');
            jQuery(input).attr({
                type: 'radio',
                name: attributes.code,
                disabled: 'disabled',
                value: options[i].id,
                price: options[i].price,
                id: attributes.code + attributeId + '-' + i
            }).appendTo(element);

            var label = document.createElement('label');
            jQuery(label).attr({
                for: attributes.code + attributeId + '-' + i
            }).html(this.getOptionLabel(options[i], options[i].price)).appendTo(element);

            if(prevConfig) {
                for(var j = 0; j<options[i].products.length; j++) {
                    if(prevConfig.config.allowedProducts
                        && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){
                        allowedProducts.push(options[i].products[j]);
                    }
                }
            } else {
                allowedProducts = options[i].products.clone();
            }

            if(allowedProducts.size() > 0) {
                options[i].allowedProducts = allowedProducts;
                jQuery(input).removeAttr('disabled');
            }
            if(!element.options)
                element.options = [];
            element.options[i] = input;
            element.options[i].config = options[i];
        }
    }
}

I have also modified configurable.phtml file and removed the select tags and moved the id and classes to the input container:
<?php foreach($_attributes as $_attribute): ?>

<?php echo $_attribute->getLabel() ?>

    <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
        <div class="input-box super-attribute-select" id="attribute<?php echo $_attribute->getAttributeId() ?>">

<?php endforeach; ?>

Now I'm only debugging the javascript functions (event firing, etc) so that the radio buttons are disabled with every "main" option change


texts:
Found this one: https://github.com/amg-dev/magento-amg-sentry-extension
Anyone else having other ideas?


texts: Import attribute for Youtube videos in Products

texts:
I would like to import my products with the YouTube video in the "image or video gallery". Do you guys know the right attribute?

I did for all pictures and worked fine, but I don't know for videos.


texts: How to change Product Listing Sort by custom select option?

texts:
In my module, I have created a select option with attributes. When I select an attribute, that attribute will be set to sort by default. How can I do that. I found

  Magento\Catalogfile\Block\Product\ProductList\Toolbar.php

but I do not know how to use the plugin to change that default value.
Can anyone help me ?


texts: Product url give 404 error to crawling even product is enabled and visibility set to catalog search.

texts:
Some of the products url gives 404 error to crawl url, if that product is enabled and visibility set to catalog, search. Also i found there is some product randomly giving 404 error to crawl.

I have checked products in admin and is enabled with stock set. I checked the URL rewrite section but couldn't find anything. Also, tried reindexing everything, but couldn't resolve the issue. Even flushed the cache still nothing.

If i hit the particular product url, its working properly.


texts: How to obtain a JSON order rendered by the REST API in the sales_order_place_after event observer

texts:
I have an observer for the event "sales_order_place_after" that needs to take the order and transform it into a JSON object to be sent to an external system (over REST). However the JSON representation should be identical to the same order rendered by the REST API V2 (ie, only showing the attributes defined in api2.xml).

Is there any helper method that can do this?


texts:
The little project is to export all items (sku and quantity) of an order using the Magento (1.9.3.2) events.

My NvM2MfExport.xml in /app/etc/modules:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <NvM2MfExport>
            <active>true</active>
            <codePool>community</codePool>
            <depends>
                <Mage_Checkout />
            </depends>
        </NvM2MfExport>
    </modules>
</config>

My config.xml in /app/code/community/NV/M2MfExport/etc:

<?xml version="1.0"?>
<config>

    <modules>
        <NvM2MfExport>
            <version>1.0.0</version>
        </NvM2MfExport>
    </modules>

    <global>
        <models>
            <nvm2mfexport>
                <class>Nv_Export_Model</class>
            </nvm2mfexport>
        </models>
        <events>
            <checkout_cart_save_after>
                <observers>
                    <nvm2mfexport>
                        <class>nvm2mfexport/observer</class>
                        <method>orderExport</method>
                    </nvm2mfexport>
                </observers>
            </checkout_cart_save_after>
        </events>
    </global>

</config>

My Observer.php in /app/code/community/Nv/M2MfExport/Model:

<?php

class Nv_Export_Model_Observer
{
    public function orderExport($observer)
    {
        //require_once '../app/Mage.php';
        //Mage::app();

        // Übergebenes Quote und Order Objekt holen
        $order = $observer->getEvent()->getOrder();
        $quote = $observer->getEvent()->getQuote();

        // Nur schicken wenn tatsächlich eine Adresse zugewiesen wurde
        if ($quote->getDistributorEmail())
        {
            // Lieferadresse als Text formatiert holen
            $shipTo = $order->getShippingAddress()->format('text');
            $itemsTxt = "Items\n-----------------------\n";

            foreach ($order->getAllVisibleItems() as $item)
                $itemsTxt .= 'SKU: ' . $item->getSku() . ' QTY: ' . $item->getQtyOrdered() . "\n";

            $mail = Mage::getModel('core/email')
                ->setFromEmail('~@~.de')
                ->setSubject('Neue Bestellung')
                ->setToEmail('~@~.de')
                ->setBody("Lieferadresse:\n\n" . $shipTo . "\n" . $itemsTxt)
                ->send();
        }

        /*$myfile = fopen("/var/www/magento-1.9.3.2/newfile.txt", "w") or die("Unable to open file!");
        $txt = "John Doe\n";
        fwrite($myfile, $txt);
        $txt = "Jane Doe\n";
        fwrite($myfile, $txt);
        fclose($myfile);*/
    }
}

The module is shown in the admin and enabled.

After a successfully order submit inside the backend (admin) I expected getting an email with some information. But nothing - not even a system log entry (logging is set on).

I also changed something in my php file that should result in throwing an error and another log entry. But nothing too. That's why I suggest that my Observer.php will not be called.


texts: Showing Configurable Products in Transactional Emails

texts:
I'm trying to fix an issue that I have, I'm able to display the product image in my transactional email just fine but when it's a configurable one, the thumbnail is broken. Can anyone please help me understand why?

foreach ($wa_data['items'] as $key => $value) {
    $vars = get_object_vars ($value);
    $_product = Mage::getModel('catalog/product')->setStoreId($value->getOrder()->getStoreId())->load($value->getProductId());
    $item = array(
      'url' => $_product->getProductUrl(),
      'imgUrl' => Mage::getSingleton('catalog/product_media_config')->getMediaUrl($_product->getThumbnail()),
      'name' => $value->getName(),
      'sku' => $vars['_data']['sku'],
      'description' => $vars['_data']['description'],
      'number' => $vars ['_data']['product_id'],
      'qty' => intval($vars['_data']['qty_ordered']),
      'price' => $wa_data['symbol'] . ' ' . intval($vars['_data']['base_price']),
      'total' => $wa_data['symbol'] . ' ' . intval($vars['_data']['base_row_total']),
    );
    $wa_data['items'][$key] = $item;
}

and the image is

<img src="<?php echo $_item['imgUrl'] ?>

Thank you kindly


texts:
I want to add an image on the contact us form as marked here https://prnt.sc/oryyn0
This should be basically a second column and image should be placed next to Name, email.


texts:
I want that on a custom checkout page to have as a first step select checkout: login, register and checkout as guest. I have managed to login customer and then to remain on checkout page. When the user chose register radio button, I need to display the register form and to register the user and then to continue checkout process with the logged in customer.
I am stuck with register form, so maybe you have an idea.


texts: Magento 2 stop (or) avoid resize product image at admin end?

texts:
In Magento 2.2.3 CE, Is it possible to get default maximum image dimensions in Magento when uploading images at admin end?

For example,

I uploaded some images to a product that were 2400x2400 and 1800x1800, but they were resized to 1200x1200 on the product page.

I would like to keep the original image sizes because I need higher resolution on some product images to show greater detail.

Magento Admin end while upload:


texts: Error when running bin/magento setup:upgrade after creating Module on Magento 2

texts:
I'm trying to create a module on a local installation of Magento 2.1.4.

i'm getting this error when running bin/magento setup:upgrade:

[Zend_Db_Adapter_Exception]
SQLSTATE[HY000] [2002] No such file or directory

[PDOException]
SQLSTATE[HY000] [2002] No such file or directory

setup:upgrade [--keep-generated] [--magento-init-params="..."]

After this i tried this solution: Cannot create new module in magento2 - php bin/magento setup:upgrade

The outcome was the same and there is not much explanation on what this did to solve the problem.

I also read solutions from almost a year ago when apparently this was a common issue deleting var/cache, var/generation and var/di but that didn't worked either.


texts: Unable to run core_email_queue_send_all task?

texts: i tried to run the core_email_queue_send_all task from AOE scheduler and I got the error. Please see screenshot.


texts: Magento 2 Load - Block (CMS Static Block in Magento 1 terms)

texts:
I am attempting to load a static block from my controller - but am having trouble locating the right syntax for doing this.

What is the proper syntax to load a CMS block by identifier or block id and what factory supports this type of loading?


texts: Can't find ElasticSearch 6.0+ option in magento 2.3.1 backend (CE)

texts:
I installed elasticsearch into my server using the following guide: https://devdocs.magento.com/guides/v2.3/config-guide/elasticsearch/es-overview.html

So I have elasticsearch 6.7 installed right now but inside my Magento 2.3.1 (CE) backend I can only see this:

Search Engine

MYSQL
Elasticsearch
Elasticsearch 5.0+

I also updated my composer.json file with:

"elasticsearch/elasticsearch": "~2.0|~5.1|~6.7"

I want to fix this problem because when I run the reindex this happens:

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Enabling [_all] is disabled in 6.0. As a replacement, you can use [copy_to] on mapping fields to create your own catch all field."}],"type":"illegal_argument_exception","reason":"Enabling [_all] is disabled in 6.0. As a replacement, you can use [copy_to] on mapping fields to create your own catch all field."},"status":400}

And I think the source is probably this difference between the versions.


texts: Magento 2: Admin ui grid inline edit not working

texts:
I create admin ui grid and i want to add functionality of inline editable grid. But,  it's not working for me.

This is my vendor_module_test_listing.xml file code:

<item name="editorConfig" xsi:type="array">
    <item name="selectProvider" xsi:type="string">vendor_module_test_listing.vendor_module_test_listing.vendor_module_test_columns.ids</item>
    <item name="enabled" xsi:type="boolean">false</item>
    <item name="indexField" xsi:type="string">entity_id</item>
    <item name="clientConfig" xsi:type="array">
        <item name="saveUrl" xsi:type="url" path="*/*/inlineEdit"/>
        <item name="validateBeforeSave" xsi:type="boolean">false</item>
    </item>
</item>

What I missing or do any mistake?

Please help me.

Thanks.


texts: Doubt Regarding Magento Subdomain Creation

texts:
We have developing a e-commerce website in magento. We have two type of products.

Electrical
Apparels

We need to set-up two sub-domain for same Magento installation.What are the steps for achieving this?

I need urls looks like this.

electrical.example.com
apparels.example.com


texts:
I just switched from cache in files to redis, and according to benchmark, my store is about 10 % slower. This is my config:

<cache>
    <backend>Mage_Cache_Backend_Redis</backend>
    <backend_options>
        <server>redis</server>              <!-- or absolute path to unix socket -->
        <port>6379</port>
        <persistent></persistent>               <!-- Specify a unique string like "cache-db0" to enable persistent connections. -->
        <database>0</database>
        <password></password>
        <force_standalone>0</force_standalone>  <!-- 0 for phpredis, 1 for standalone PHP -->
        <connect_retries>1</connect_retries>    <!-- Reduces errors due to random connection failures -->
        <read_timeout>10</read_timeout>         <!-- Set read timeout duration -->
        <automatic_cleaning_factor>0</automatic_cleaning_factor> <!-- Disabled by default -->
        <compress_data>1</compress_data>        <!-- 0-9 for compression level, recommended: 0 or 1 -->
        <compress_tags>1</compress_tags>        <!-- 0-9 for compression level, recommended: 0 or 1 -->
        <compress_threshold>20480</compress_threshold>  <!-- Strings below this size will not be compressed -->
        <compression_lib>gzip</compression_lib> <!-- Supports gzip, lzf and snappy -->
    </backend_options>
</cache>

I'm using docker with redis as linked container. Any idea?


texts: Is there a native way to redirect a user to a page including a status code within an event observer?

texts:
I need to redirect a user to another page with a status code of 503 within an event observer. While I am able to redirect the user with Mage::app()->getFrontController()->getResponse()->setRedirect('/foo/bar/'), this doesn't appear to take an argument for a status code. Using header() doesn't work either, presumably because it's called too late in the process.

I've been scratching my head for ages, so I might be looking over something incredibly obvious. Any pointers would be appreciated, however. Thanks in advance!


texts: I have only one product and I have to sell directly and not via product page or home page. When visiting the site URL it should directly add a product into the cart and redirect to checkout page.


texts: I am trying to override model class "Mage_Catalog_Model_Layer" but nor work?

texts:
I am trying to override "Mage_Catalog_Model_Layer" class but not work.

i) config.xml

<config>
  <modules>
    <Surtikart_Underprice>
      <version>0.1.0</version>
    </Surtikart_Underprice>
  </modules>
  <global>
    <helpers>
      <underprice>
        <class>Surtikart_Underprice_Helper</class>
      </underprice>
    </helpers>
    <models>
      <underprice>
        <class>Surtikart_Underprice_Model</class>
        <resourceModel>underprice_mysql4</resourceModel>
      </underprice>
            <catalog>
                <rewrite>
                    <layer>Surtikart_Underprice_Model_Catalog_Layer</layer>
                </rewrite>
            </catalog>
    </models>
  </global>
</config>

ii) class file

<?php
class Surtikart_Underprice_Model_Catalog_Layer extends Mage_Catalog_Model_Layer
{
     public function getProductCollection()
    {
        if($this->getCurrentCategory()->getId()==290){
        $startprice=0;
            $endprice=499;
             $collection = Mage::getModel('catalog/product')->getCollection()
                        ->addAttributeToSelect('*')
                        ->addAttributeToFilter('price', array('gteq' => $startprice))
                        ->addAttributeToFilter('price', array('lteq' => $endprice));

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

        }

        return $collection;
    }
}

What is mistake i cant able to reach..

Thanks.