texts: PHP else: statements in addtocart.phtml - Adding conditions to the Add To Cart button on product page

texts:
My store has the options for user to Add To Cart, Call To Order, Visit Our Store.

I've modified the category page (list.phtml) to show "View Product" instead of Add to Cart.

On the product page, now, I need the options that my store will offer users, as stated in the first sentence. I've created attributes for these products with yes/no options when they make products. Attrib names are 'call_to_order' and 'visit_our_store' .  What I'd like to do is on the addtocart.phtml add code to look if this product has one of those attribs as yes and then show the appropriate button, replacing the normal 'Add To Cart' with the appropriate text , and preferably no action to be taken when they click the button. I'd still like it to have the same styling as the 'Add to Cart' button.

I assume this can be done using get attrib and else php, my php is very rusty and I'm not sure where to put it/how to write it.

Current addtocart.phtml:

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if($_product->isSaleable()): ?>

    <?php if(!$_product->isGrouped()): ?>

            <?php echo $this->__('Qty:') ?>
            <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />

    <?php endif; ?>
    <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><?php echo $buttonTitle ?></button>
    <?php echo $this->getChildHtml('', true, true) ?>

<?php endif; ?>

If there are other changes that would need to be made, please advise. I haven't found a solution to this on the web. Even some of the extensions that I think might work would involve custom coding as well imho. This seems like a pretty straight forward solution to my problem.

Thank you!


texts: I want to add a custom 'gift wrap' column under 'Items Ordered' so that I can add gift wrapping cost to the subtotal of the product. The page is present at admin panel->sales->orders->create new order->create new customer. The file to this page is present at (app\code\core\Mage\Adminhtml\Block\Sales\Order\Create\Items\Grid.php) Please find the screen shot of what I intend to do. I am unable to do this,please help


texts: [Magento2.2.6]What is the purpose of tables which have tmp/replica/idx as a postfix?

texts:
I'm trying to insert queries in order to add products to our Magento website.
I have no idea about these tables i mentioned at title like catalog_category_product_index_replica, catalog_category_product_index_store1,catalog_category_product_index_store1_replica.

When i implement quires, should i insert values into those tables?

Thanks a lot.


texts: Unable to open admin panel after SSL activation

texts:
Server : Amazon with CDN
Admin link : https://www.gleitsichtbrille.de/index.php/ag_supervista/

If I do the setting 'Use Secure URLs in Admin' => 'No', it is working fine and if I change to 'Yes' then it is showing an error of 'too many redirections please remove cache'.
I have already removed cache and session folder, still facing the same issue.

The site is live, so currently setting is 'Use Secure URLs in Admin' => 'No'.


texts:
There are only 3 products in the catalog, when I try to export them using

  System -> Import/Export -> Export

I get this error:

Fatal error: Call to undefined method Mage_ImportExport_Model_Export_Adapter_Csv::getRowsCount() in /app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 575

According to the host it seems to be an issue with 'autoload', I should check the path or do a clean instal.

What is autoload and what path should I check? Or what else could be the problem?


texts: Get attribute_code or attribute_id in layered catalog\layer\view.phtml

texts:
I used a Layered Navigation SEO to make my layered navigation to have a multiselect on filter and AJAX updater result and layered navigation. Every filter in layered navigation is in Bootstrap 3 collapse. The problem is that when user extend a filter and select something, layered navigation is reloaded by AJAX request and every field is collapsed, witch is annoying.

I want to make some customization on that and add to each filter some unique HTML attribute like data-attribute-code and add some info about witch collapse are extend, so I can set then to be extended when layered navigation is reloaded.
Current problem that i have is that i can get only the name of the filter with $_filter->getName() witch is not good to use like identification for filter. But when i try to get a attribute code or id i get empty stings. I try with this code

$_filter->getId();
$_filter->getCode();
$_filter->getAttributeId();
$_filter->getAttributeCode();

If someone can help me and show how to get attribute ID or Code i will be very thankful.


texts: Deploy files in Magento2 while theme developement

texts:
When developing, do I need to clear caches everytime I change a file?

I have set my env to developer with

$ php bin/magento deploy:mode:set developer

Magento now build Symlinks to my themes file for each file that has to be loaded. However, if I make a change to a *.css file and save it, no changes are made.

Therefore I delete the whole cache everytime I change something, which is quiet a pain.

I do so with:

$ rm -rf var/page_cache/* var/cache/* var/view_preprocessed/* pub/static/frontend/* var/tmp/*

Logically Magento has to rebuild all this stuff. This is time consuming. How can I speed up things? Can I delete specific files directly and if so, where do I find them?

My Cache Settings are:

Current status:
                        config: 0
                        layout: 0
                    block_html: 0
                   collections: 1
                    reflection: 1
                        db_ddl: 1
                           eav: 1
         customer_notification: 1
                     full_page: 0
            config_integration: 1
        config_integration_api: 1
                     translate: 1
             config_webservice: 1


texts: Prevent applying shopping cart rule for specific customer

texts: Is it possible to prevent applying shopping cart price rule, for the specific customer, of the using event observer?


texts: How to Place order for specific product id?

texts:
This is my controller to add a specific product to the cart. It is working fine. Now I don't need to add in cart, but directly to place order using product id. My product id is 483. I need to place order this product and redirect to another page.

<?php

namespace Module\Name\Controller\Index;

class Places extends \Magento\Framework\App\Action\Action
{

protected $formKey;
protected $cart;
protected $product;
protected $_response;
protected $customerRepository;
protected $addressRepository;

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\Data\Form\FormKey $formKey,
\Magento\Checkout\Model\Cart $cart,
\Magento\Catalog\Model\Product $product,
 \Magento\Framework\App\ResponseInterface $response,
 \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository ,
 \Magento\Customer\Api\AddressRepositoryInterface $addressRepository,

array $data = []) {
    $this->formKey = $formKey;
    $this->cart = $cart;
    $this->product = $product;
     $this->_response = $response;
     $this->customerRepository = $customerRepository;
     $this->addressRepository = $addressRepository;
    parent::__construct($context);
}

public function execute()
 {

  $productId =483;
  $params = array(
                'form_key' => $this->formKey->getFormKey(),
                'product' => $productId, //product Id
                'qty'   =>1
               //quantity of product
            );
    //Load the product based on productID
    $_product = $this->product->load($productId);
    $this->cart->addProduct($_product, $params);
    $this->cart->save();
    //$this->_response->setRedirect('magento')->sendResponse();

 }

}


texts:
I have this error during reindex.

PHP Fatal error:  Maximum execution time of 18000 seconds exceeded in .../app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Table.php on line 98 Segmentation fault

All reindex procedures are working fine but error only for catalogsearch_fulltext.

Magento version 1.9.2.1. In this moment I cannot upgrade version.

Thanks


texts: How to auto complete / invoice order in Magento?

texts:
I have Magento webshop, and I sell virtual products, with API all my products get send out automatically when the order is invoiced / completed.
It would be a lot easier if It could complete / invoice all orders automatically, is this possible?
It's my first time using Magento, so I'm a little blank at this point.

I'm using Magento 1.9.3.


texts:
How to get quote Id from quote table via Customer Id or email.

I have Customer id & email & i want to check if quote id exist or not how to do that via create new module or programming

What i want : I want to pass customer id & excepting quote data

Any Help much be Appreciated


texts: Is it safe to use one instance of a Model to load several different entities?

texts:
Are there side-effects, or issues with doing something like this:

// Retrieve the Model once
$model = Mage::getModel('some/model';

// Load several different instances
foreach($idlist as $id)
{
    $entity = $model->load($id);
}

Or should the Model be retrieved within the loop?

// Load several different instances
foreach($idlist as $id)
{
    // Retrieve the Model once per instance
    $model = Mage::getModel('some/model';
    $entity = $model->load($id);
}


texts: Extension Installer Issue (Magento Connect Manager)

texts:
Issue with magento connect manager. In admin panel, when you go to System --> Magento Connect --> Magento Connect Manager. It redirects you to the following URL:http://thepoultryhatchery.com/downloader/?return=http%3A%2F%2Fthepoultryhatchery.com%2Findex.php%2Fadmin%2F

my url is: www.ThePoultryHatchery.com

Site is in maintenance mode so you must go to thepoultryhatchery.com/index.php if you need to see site. Setup in Multi-Store using 1 back-end but two stores due to pricing being different for store pick up / shipping.

Attached is screen shot of what it does. It seems its a redirect to a 404 Not found 1 Error. Anyone have a solution to fix this issue? I don't think any files are missing?

Any help would be greatly appreciated? Is there another method of installing extensions other than this option or is it required?

@JELLEJ  - htaccess file: http://www.filedropper.com/htaccess_2


texts: Is there any way to reload custom admin ui grid with ajax? Just like it reloads when you for example sorting by clicking a column name. I just need this grid table to be updated with new data. Is there any js function for that in magento 2 ?


texts: How to implement secure cookie check in Magento 1.4.1.1 similar to Magento 1.9?

texts:
We have an option for secure cookie check in Magento 1.9.1 as per
Magento Community Edition 1.9.1 release notes

Added a secure cookie flag for the storefront to prevent man-in-the-middle attacks. There is no change to the Secure and Unsecure Web configuration options.

Does this help to overcome this  OWASP-2010: A3, issue?

app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

.

      if (Mage::app()->getFrontController()->getRequest()->isSecure() && empty($cookieParams['secure'])) {
        // secure cookie check to prevent MITM attack
        $secureCookieName = $sessionName . '_cid';
        if (isset($_SESSION[self::SECURE_COOKIE_CHECK_KEY])
            && $_SESSION[self::SECURE_COOKIE_CHECK_KEY] !== md5($cookie->get($secureCookieName))
        ) {
            session_regenerate_id(false);
            $sessionHosts = $this->getSessionHosts();
            $currentCookieDomain = $cookie->getDomain();
            foreach (array_keys($sessionHosts) as $host) {
                // Delete cookies with the same name for parent domains
                if (strpos($currentCookieDomain, $host) > 0) {
                    $cookie->delete($this->getSessionName(), null, $host);
                }
            }
            $_SESSION = array();
        }
        if (!isset($_SESSION[self::SECURE_COOKIE_CHECK_KEY])) {
            $checkId = Mage::helper('core')->getRandomString(16);
            $cookie->set($secureCookieName, $checkId, null, null, null, true);
            $_SESSION[self::SECURE_COOKIE_CHECK_KEY] = md5($checkId);
        }
    }

How can I implement this feature in lower versions of Magento without upgrading to higher version? Do we have some patch or workaround for this?


texts: How to find Internal linking of pages in Magento 1.9.3.6?

texts:
webmaster tools is showing more than 500 internal link on one of my website url. many links does not relate to this page. I want to know that link structure of my webpages, is  corrected or not.

is there any tool in magento to find out internal page link or broken links?


texts:
So I've had a request of my manager and have no idea where to start!

He wants me to make a file search page (we would upload the files to a folder ie. /pdfs/).

I've no idea where I would start and have looked up tutorials to no avail?

If anyone could put me in the right direction I'd be much appreciated, the only idea I can come up with is making a page with the same skin and just doing flat php to make the file search but that wouldn't be very good obviously.


texts: Magento 2.1.9 - Admin prodcuts grid not loading

texts:
Find below screenshot and I have also run the basic commands of magento as below.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cahce:clean


texts:
Proper way of changing the root folder name in Magento2?

I want to move the files from htdocs/Magento2x_1 to htdocs/Magento2x_2.


texts: Get Price For Configurable Product Magento 2

texts:
I m working on ../Magento_Catalog/templates/product/list.phtml. I already write onsale label for products like this;

     <?php
     $label_price=$_product->getPrice();
     $final_price=$_product->getSpecialPrice();
     $save_percent = 100 - round(($final_price / $label_price)*100);
     echo $save_percent.'% Off';?>

Its working perfect for Simple product but its not working for configurable products, I know configurable products doesn't have price but how can I get configurable first child product price or get price which is show as default price.


texts: Magento 1.9.2.2 Datwflow Import Product Price Update CSV

texts:
i need to update some prices in the shop and made this many times in the last years. But now i have the problem that magento kills my product descriptions on update.

My CSV file has only two fields. SKU and price.

My Dateflow Profile is this:

<action type="dataflow/convert_adapter_io" method="load">     <var name="type">file</var>     <var name="path">var/import</var>     <var name="filename"><![CDATA[Hensel.csv]]></var>     <var name="format"><![CDATA[csv]]></var> </action>  <action type="dataflow/convert_parser_csv" method="parse">     <var name="delimiter"><![CDATA[;]]></var>     <var name="enclose"><![CDATA["]]></var>     <var name="fieldnames"></var>     <var name="map">         <map name="SKU"><![CDATA[sku]]></map>         <map name="price"><![CDATA[price]]></map>     </var>     <var name="store"><![CDATA[0]]></var>     <var name="number_of_records">1</var>     <var name="decimal_separator"><![CDATA[,]]></var>     <var name="adapter">catalog/convert_adapter_product</var>     <var name="method">parse</var> </action>

Any ideas, whats going wrong with the importer? I'm pretty sure, that this works many times ... the last usage was 2016.


texts: Magento 2 - Flushing Cache does flush cache on other project!

texts:
I created a clone of my live project and named it live_clone.
Then I changed the database credentials in app/etc/env.php to my new live_clone database and
imported the live database to it.
Then I opened the database with phpmyadmin and changed the BASE URL's to the live_clone domain.
I did this often and it always worked flawlessly.
Then I changed to deployment mode "production".
However, if I execute php bin/magento cache:flush on live_clone, then the cache is getting flushed for my live project instead of for the project live_clone. If I execute grunt clean on live_clone then users get redirected to live_clone instead of live!
What is going on?


texts: How to create a input tag have disable attribute in system.xml Magento 2

texts:
In my system.xml, i have a field tag as:

<field id="token" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
      <label>Auth Token</label>
</field>

What is attribute i need add to field tag for disable input in Configuration ?

Thanks


texts: how to retrieve Coupon Code by rule Id on Checkout Success Page?

texts:
I have coupon rule collection created at admin side and displaying rule names in the system configuration of the custom module. Actually, I wanted to get coupon code of a cart rule that has been selected by admin in system configuration and display it on success page for customer to use it in next order.
Getting Rules Coupon Code Collection by this:

<?php
namespace Vendor\Module\Block;
use Magento\Framework\View\Element\Template;

class Coupon extends Template
{

protected $_salesRuleCoupon;

public function __construct(
    Context $context,
    \Magento\SalesRule\Model\ResourceModel\Coupon\CollectionFactory $salesRuleCoupon
)
{
    $this->_salesRuleCoupon = $salesRuleCoupon;
}

 public function getCouponsList()
{
   $collection= $this->_salesRuleCoupon->create();
   return $collection->getData();
}

}

and in template:

$coupons=$block->getCouponsList();
foreach($coupons as $coupon){
echo $coupon['code'];
}

Rules Collection in admin side (System Configuration) is retrieved by doing this:

<?php
namespace Vendor\Module\Model\Config;

class CouponCode implements \Magento\Framework\Option\ArrayInterface
{
/**
 * @return array
 */
public function toOptionArray()
{

    $om = \Magento\Framework\App\ObjectManager::getInstance();

    $arr = [];

    $couponCollection = $om->create('Magento\SalesRule\Model\Rule')->getCollection();

    foreach ($couponCollection as $rule) {
    $arr[] = ["value" => $rule->getId(), "label" => __( $rule->getName() ) ];
}

return $arr;

}
}

calling it in source model as:

<field id="coupon_code" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Use Coupon Code Rule</label>

<source_model>Vendor\Module\Model\Config\CouponCode</source_model>
<depends>
         <field id="display">1</field>
</depends>
</field>

when I retrieve the configuration value of a selected Rule in the custom module, it displays its ID as in Cart Price Rules Grid in the backend. All I need is to get Coupon Codes through their Cart Price Rules' ID and display only those rules in the system configuration that have coupon codes and display the coupon code of selected Rule from system configuration on success page.

Any help is highly needed and will be positively appreciated!


texts: Magento2: How to add Country and State field at backend in creating customer under the Account Information tab?

texts:
I want to add country and State field at the backend in creating customer under the Account Information tab.

Based on the Country selected the State should filter in the dropdown.

Any help would be appreciated.


texts: trying to add a phtml file using controller_action_layout_load_before in frontend on cart page

texts:
I am trying to add a phtml file using my custom module in cart page only at bottom of content or above the footer section

In /magento1/app/code/local/Maddyboy/Instagramapi/etc/config.xml

<controller_action_layout_load_before>
    <observers>
        <Maddyboy_Instagramapi_layout_load_before>
            <class>Maddyboy_Instagramapi_Model_Observer</class>
            <method>controllerActionLayoutLoadBefore</method>
        </Maddyboy_Instagramapi_layout_load_before>
    </observers>
</controller_action_layout_load_before>

In  /magento1/app/code/local/Maddyboy/Instagramapi/Model/Observer.php

public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
     $layout = Mage::getSingleton('core/layout');
     $content = $layout->getBlock('content');
     $newBlock = $layout->createBlock('core/template', 'example_block_name');
     $newBlock->setTemplate('instagramapi/apislider.phtml');
     $content->append($newBlock);  // this line gives 500 error
}

if i uncomment the $content->append($newBlock); then no errors.

i followed
What are errors in my code?


texts: Magento 2 - Mass Update Tier Pricing for products

texts:
We have 1000 products all with their own tier pricing setup (often buy 3, buy 6).
What is the fastest way of mass updating these products?
I would assume

go to catalog
select products
click massupdate
set tier pricing
hit save

How does mass updating tier pricing work for updating large product catalogs?


texts: Magento 2 Simple Model Observer not working

texts:
May be "clarification" is one of the reasons, I am posting a query about Magento 2 Observer here.

As I am trying to execute an event observer on sales_quote_collect_totals_after event but it doesn't seem to run at all, when I do hard-refresh the Checkout/Cart page.

I have searched many online posts and tutorials, but every post seems to have different code and it goes a bit confusing at times, so my final question is how to get observer working with only observer class file and events xml ?

Learning/Custom/Model/Observer:

<?php

namespace Learning\Custom\Model;

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

class Observer implements ObserverInterface {
    public function execute(Observer $observer) {
        $event = $observer->getEvent();
        $quote = $event->getQuote();
        Mage::log(print_r(Zend_Debug::dump($quote->getData()), true),NULL, 'developer.log');
        exit;
    }
    /*public function execute(\Magento\Framework\Event\Observer $observer) {
        rm_state()->controllerSet($observer['controller_action']);
    }*/
}

etc/frontend/events.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd">
        <event name="sales_quote_collect_totals_after">
        <observer name="learning_custom_event_obs" instance="Learning\Custom\Model\Observer" />
    </event>
</config>

etc/module.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Learning_Custom" setup_version="1.0.0">
        <sequence><module name="Magento_Core"/></sequence>
        <sequence><module name="Magento_Store"/></sequence>
    </module>
</config>


texts: How to get product price filter by store

texts:
I am trying to get product price according to store Id in Magento. I am using the below code :

$store_id=2;
$collection=Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect(array('name','image', 'price','special_price', 'special_packing','prosort','description','special_from_date','special_to_date'))
->addStoreFilter($store_id)
->addAttributeToSort('position');
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

foreach($collection as $product){

$products = Mage::getModel('catalog/product')->load($product->getId());
print_r($products->getPrice());
}

But in return i get Default price, is there anything i am missing or doing wrong?

Any help appreciated.


texts: Deactivating and reactivating plugins on-the-fly

texts:
I am currently developing on a VM with a Ubuntu host machine - it is super slow.
I am currently trying to implement a plugin but the magento s:d:c command takes 6 minutes.
Within examples for Plugins it shows that you can set a 'disabled' var on a Plugin declaration. I guess this is only really to decativate inherited plugins, but it looks temptingly like it could also be used to deactivate/activate plugins quickly.
I experimented a bit and it seems like this is not the case, but then I was then curious, what would be best && safest way to activate/deactivate plugins as quickly as possible without having to compile every time?
I just really need to speed up this process as I need to switch this plugin off and on frequently in order to see what effects it has over default module functionality. Should I just comment all the methods in the interceptor?
If anyone is poised to tell me I should upgrade my setup, believe me I know, I have already a fair few hours on getting a Docker setup running but I have DB issues.
Thanks in advance


texts: AJAX validation form in custom backend module

texts:
I create custom module and would like to validate the input fields such date.

I tried in Form.php

public function _prepareForm()
{
    $form = new Varien_Data_Form(array(
        'id'     => 'edit_form',
        'method' => 'post'
    ));

    $f = $form->addFieldset('User', array(
        'legend' => 'Add User',
        'class'  => 'fieldset-wide'
    ));

    $f->addField('to', 'date', array(
        'name'     => 'to',
        'label'    => 'Date to',
        'format'   => 'DD-MM-YYYY',
        'class'    => 'validate-date',
        'required' => true
    ));
}

But the class is not added, and nothing does it.

What am I doing wrong?


texts: Add jQuery module to admin form field - Color wheel Magento 2

texts:
I need to add a colour picker as a admin form field - I have added what I believe is needed to get the JS working but it's still throwing errors and showing me no form field. The color picker I'm trying to use is: http://www.jar2.net/projects/jquery-wheelcolorpicker

I have declared my form field like:

 <field name="colour">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Vendor_Module/js/form/element/color-select</item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="elementTmpl" xsi:type="string">Vendor_Module/form/element/color-select</item>
                    <item name="label" xsi:type="string">Colour</item>
                    <item name="visible" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">roundel</item>
                </item>
            </argument>
        </field>

The JS form element file looks like:

require(['jquery','colorwheel'],function($){
    $(window).load(function() {
        $('#color-wheel-picker').wheelColorPicker();
    });
});

The colorwheelpicker minified JS file is in the same directory as the above file. I can see it being added to the head OK.

And I have declared my require config like this and its just sitting in Vendor/Module/view/adminhtml:

var config = {
    map: {
        '*': {
            colorwheel: 'Lewis_Roundel/js/form/element/jquery.wheelcolorpicker-3.0.2.min'
        }
    }
};

But when I rebuild the admin theme, I received this error and no form field at all, let alone a color wheel:

Anyone have any ideas? My JS knowledge is not up to scratch!


texts: Magento 2: get masonry working / source file path

texts:
Magento2 is installed via composer
I've written a custom theme, based on luma
masonry is installed via bower - the bower_components folder is placed in: app/design/frontend/VENDOR/MY_THEME/web

I've defined a new requireJS module for masonry in a requirejs-config.js

Question 1: Where should that file be? In .../MY_THEME/Magento_Theme or directly in my theme?
Question 2: What is the correct path to the masonry source file in the bower_components? Because all my custom js-files end up somewhere below pub/static/frontend...

var config = {
    paths:{
        // creates a module named 'masonry'
        // points to the masonry source file
        "masonry":"???/web/bower_components/masonry/masonry"
    },

    shim:{
        // make sure that jquery is completely loaded when masonry starts loading
        'masonry':{
            'deps':['jquery']
        }
    }
};

I've read the answers of this question - but can't get it work without the correct source path.


texts: How to get custom attribute value with product id of enable product with SQL query in Magento 2?

texts:
How to get custom attribute value with product id of enabled product with SQL query in Magento 2?
I am using
SELECT entity_id,value FROM catalog_product_entity_varchar WHERE attribute_id = 150

But it gives me all data I want these data only to enable products.
Any help is appreciated.


texts: Magento 2 - Custom shell command not working

texts:
I want to execute some code using custom command like:

php bin/magento mycommand:dothis

To enable this command I have added this code in di.xml

<type name="Magento\Framework\Console\CommandList">
    <arguments>
        <argument name="commands" xsi:type="array">
            <item name="do_this" xsi:type="object">Vendor\Module\Console\Command\DoThis</item>
        </argument>
    </arguments>
</type>

In my .php file

app/code/Vendor/Module/Console/Command/DoThis.php

File code is:

<?php

namespace Vendor\Module\Console\Command;

use Magento\Framework\App\State;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DoThis extends Command
{
    /**
     * @var State
     */
    protected $appState;

    public function __construct(
        State $appState
    ) {
        $this->appState = $appState;
        parent::__construct('mycommand');
    }

    /**
     * Configure cli command.
     */
    protected function configure()
    {
        $this->setName('mycommand')
            ->setDescription('This will run do this');
    }

    /**
     * Execute cli command
     * @param InputInterface $input
     * @param OutputInterface $output
     * @return $this|int|null
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    protected function execute(
        InputInterface $input,
        OutputInterface $output
    ) {
        $this->appState->setAreaCode('adminhtml');

        //My code here

        $output->writeln('Process finished.');

        return $this;
    }
}

On shell, I am facing this error:

  Command "mycommand:dothis" is not defined.


texts:
I need to filter a collection based on the following WHERE clause:
WHERE ('invoice_state' == 'cancel' AND 'invoice_state_code' == 5) OR ('invoice_state' == 'open' AND 'invoice_state_code' == 1)

How can I achieve this using $collection->addFieldToFilter() method?


texts:
I can not find a way to retrieve the value of a table from the database. With Magento 1.9 you used the Mage class but now you can no longer use with Magento 2.0.2.

How to do?


texts:
An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig).

Above error appears on di compile, cache clean etc.
I am not sure why this error appearing.
Is their any fix for this?


texts: How to add the webp format in the mod_expires part of the .htaccess file?

texts:
I add this line but it is not taken into account because the browser inspector tells me that the cache is 2 days for webp images:

ExpiresByType image/webp "access plus 1 month"

I use Plesk with Varnish.

<IfModule mod_expires.c>

    ExpiresActive On
    ExpiresDefault "access plus 2 days"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"

</IfModule>


texts: How to load 3 static blocks in 3 column layout page magento 2

texts:
I want to create 3 column page layout and want to call three static blocks into that page. Like

One block to add static data in main content area section,
second block to add data in left side area, and
third one to add data in right side area.

So what should i declare in custom layout file. Like i have declared layout=3columns but when i add anything into body section then it will be added to left side area only.
How can i use all these three blocks in 3-column.
Thanks in advance.


texts: Delete custom cookie in logout observer not working

texts:
I have an observer which is triggered properly on customer logout. The observer's execute method looks like this:

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $this->masterfilterHelper->deleteMasterFilterCookie();
}

The function deleteMasterFilterCookie() looks like this:

public function deleteMasterFilterCookie(): void
{
    $this->cookieManager->setPublicCookie('masterfilter', '');
    $this->cookieManager->deleteCookie('masterfilter');
}

The function is deleteMasterFilterCookie() is called properly, but the cookie is still available afterwards. When I call this function in other observer, everything works as expected.

UPDATE:
events.xml

The delete-function is called in reset-masterfilter-homepage and there's no problem.
The reset-masterfilter-logout oberserver is also called properly but the cookie deletion has a different behaviour here.

<?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="controller_action_predispatch">
        <observer name="reset-masterfilter-homepage" instance="Vendor\Module\Observer\MasterfilterHomepage" />
    </event>
    <event name="customer_logout">
        <observer name="reset-masterfilter-logout" instance="Vendor\Module\Observer\MasterfilterLogout" />
    </event>
</config>


texts: Magento2 Contact Us email is received via wrong from email address

texts:
Magento2 I am using SMTP for my Magento2 setup
But I am facing a strange issue
The contact us an email received have wrong from the email address.
The name (Sender Name) is correct in the form email address which I set in General contact, but the email address is not of Sender Email


texts: Function getUrl of magento 2 doesn't work correct

texts:
In template I try to get url link but it doesn't work correct. I try to use this code:

$block->getUrl('aloha/product/view/id/')

But it always return http://abcs.com/aloha/product/view/, Is this a bug?


texts: Out of memory on collectionFactory->create()

texts:
I'm getting a strange error on code which previously worked and now dont.

    <?php

    namespace Itstod\LinkedProducts\Model;

    use Itstod\LinkedProducts\Api\LinkInterface;
    use Itstod\LinkedProducts\Model\ResourceModel\LinkedProducts\Collection;
    use Itstod\LinkedProducts\Model\ResourceModel\LinkedProducts\CollectionFactory;
    use Magento\Catalog\Model\Product;
    use Magento\Catalog\Api\ProductRepositoryInterface;

    class Resthandler implements LinkInterface
    {
    /**
     * @var Product
     */
     protected $product;

    /**
     * @var LinkedProduct[]
     */
    private $instances = [];

    /**
     * @var ProductRepositoryInterface
     */
    private $productRepository;

    /**
     * @var CollectionFactory
     */
    private $collectionFactory;

    public function __construct(ProductRepositoryInterface $productRepository,CollectionFactory $collectionFactory)
    {
        $this->productRepository = $productRepository;
        $this->collectionFactory = $collectionFactory;
    }

    /**
     * @api
     * @param string $sku product sku.
     * @return LinkedProduct[].
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function get($sku) {

         /**
         * @var LinkedProduct[]
         */
        $returnvalue = [];

        $this->product = $this->productRepository->get($sku);

        $id = $this->product->getId();

        /** @var Collection $collection**/
        $collection = $this->collectionFactory->create()->addFieldToFilter('head_product_id', $id);

        // $collection = $collection->getSelect();

        /** @var \Itstod\LinkedProducts\Model\LinkedProduct $prod */
        /*
        foreach ($collection as $prod)
        {

            $returnvalue[] = $this->productRepository->getById($prod->getData('linked_product_id'));

        }
        */

        return $returnvalue;
    }
}

this code is giving me:

    "Fatal Error: 'Allowed memory size of 1073741824 bytes exhausted (tried to allocate 803225600 bytes)' in '\/home\/<url>\/public_html\/vendor\/magento\/module-eav\/Model\/Entity\/Collection\/AbstractCollection.php' on line 249"

and as you can i see i commented out most of the code to find this error.
The crash is happening in the ->create() function as i have tried it on its own and its still crashing.

Update!

Found the error, i was trying to extend the wrong abstract collection, in my collection class.


texts: How to Place order programmatically Magento 2

texts:
ive built a custom payment method followed a few tutorials to get the output.
but im now stuck at the point where 'Place Order' won't work.

I am using Magento 2. If i could get some guidance on where to call my payment method to display the success page that would be great.

I currently have this setup in my model.

<?php

     namespace Jacks\Custompayment\Model;
    /**
    * Class Custompayment
    *
    * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface
      getExtensionAttributes()
     *
     */
     class Custompayment extends \Magento\Payment\Model\Method\cc
     {
     const PAYMENT_METHOD_CUSTOMPAYMENT_CODE = 'custompayment';
    /**
     * Payment method code
     *
     * @var string
     */
    protected $_code = self::PAYMENT_METHOD_CUSTOMPAYMENT_CODE;
    /**
     * @var string
     */
    protected $_formBlockType = \Emipro\Custompayment\Block\Form\Custompayment::class;
    /**
     * @var string
     */
    protected $_infoBlockType = \Emipro\Custompayment\Block\Info\Custompayment::class;

    protected $_canAuthorize= true;

    /**
     * @return string
     */
    public function getPayableTo()
    {
        return $this->getConfigData('payable_to');
    }
     /**
     * @return string
     */
    public function getUsername()
    {
        return $this->getConfigData('businessID');
    }
     /**
     * @return string
     */
    public function getPassword()
    {
        return $this->getConfigData('password');
    }

     public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
    {
        if (!$this->canAuthorize()) {
            throw new \Magento\Framework\Exception\LocalizedException(__('The authorize action is not available.'));
        }
        return $this;
    }

    public function savePaymentInformationAndPlaceOrder($cartId,\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,\Magento\Quote\Api\Data\AddressInterface $billingAddress = null)
    {

    $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
    try
    {
        $orderId = $this->cartManagement->placeOrder($cartId);
    }
     catch (\Exception $e)
     {

        throw new CouldNotSaveException(
            __('An error occurred on the server. Please try to place the order again.'),
            $e
        );
    }
    return $orderId;
}


texts: Store switch is not working for custom categories

texts:
I have added a categories and called that through CMS block.
When I go to that category from homepage it is going fine.
After that if I try to change the language,it is not accpeting.
say:
http://localhost/US/notebook(normal url)
http://localhost/US/notebook(Even after switching it to french store)

**Note:**I'm maintaining storeviews.

Thanks in advance for your help!


texts: Magento2 - Need to change order Item by Price in email

texts:
I need to customize order Email to display items order by High to Low price. But unable to find the exact file for this.

Any help will be appreciated !!


texts: how to add stores and views programmatically

texts:
can I use install scripts to configure multiple stores and views?

Can I find any examples?
thanks


texts: Allow store scope attributes in Configurable Products

texts:
Is there any way to remove the requirement that only global attributes can be used to create configurable products?

I would like to use my store scope attributes to create configurable products.

I assume it is not just as easy as removing

$attribute->getIsGlobal() == \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL

From

public function canUseAttribute(\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute)


texts: In my Current Project there is requirement like this Extended footer for HOMEPAGE and normal footer for Other pages how can I get this.


texts:
I'm trying to get some JavaScript in the head on a single CMS page in Magento 2 and cannot figure it out.  I understand how to extend layouts to include this, but I don't want the script on all pages that use a layout.  Unfortunately this script does have to be loaded before the page body loads for it to work.

In Magento 1, I simply added this to the Layout Update XML:

<reference name="head">
    <block type="core/text" name="blockname">
        <action method="setText">
            <text>
                <![CDATA[<script type="text/javascript">

However, that doesn't work in Magento 2.

Is there any way to do this?  It seems so simple, yet I've hit a wall trying to figure it out.

By the way, been a long-time lurker, and you guys are great.

Thanks.


texts: Magento 2.3.0 After change production mode minify js and minify css not working it admin side

texts:
I have tried all commands on our Magento 2.3.0 website but I am getting issue after changing to production mode. So if anyone is facing this type of error, please reply to me the proper solution. Admin side is not clickable and getting below error on the console

TypeError: require is not a function
921eba372ebcf7d66b86f7adae7cab0606c79d7f0594d4b36501050683d2a99b:95:1
    <anonymous> https://XXXXX.co.uk/oasis18/admin/dashboard/index/key/921eba372ebcf7d66b86f7adae7cab0606c79d7f0594d4b36501050683d2a99b/:95

TypeError: require.config is not a function requirejs-config.js:57:9


texts: Create a custom resource model that fetches data from 3rd-party API (non-db)

texts:
I'd like to create a custom model that connects to an API instead of the Magento database. It would also be nice to be able to use (or extend) Magento's collection classes. We created a custom module not so long ago that stores information in the database but we're moving this sub-system outside of Magento and making it accessible through an API to Magento and other apps.

If I can somehow extend Magento's core abstract classes (or maybe inplement some interfaces) I think I can manage to swap my model classes without changing most of the other code that already exists in controllers, blocks, views, etc. Right now, I've created a class that connects to the API and makes the returned data accessible in an object, and a (sort of) collection class that is iterable, but I have to go through the existing code to change how everything works because these are not children of Mage_Core_Model_Abstract.

Has anyone done this?

Is this viable? I wonder if implementing these clases would take too much work, maybe nearly as much as just rewriting them from scratch.


texts:
I am trying to configure Magento 2 CE on a localhost using Docker.  I am getting these errors when I visit localhost:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '/app/magento-vars.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0

Have googled for this and not seeing any recommendations,


texts: Magento 2.1 : How can I save a shipping address using the REST V1 API

texts:
I'm trying to save just the shipping address using the REST V1 API of Magento 2. I know there is an endpoint to save the billing-address, but there seems to be lack of a way to save the shipping address.

There is a shipping-information endpoint, but this requires you to already set your shipping method.

Does anyone know how I can do this?


texts: Move Catalog Search element into Toolbar block

texts:
I need to move the catalogsearch.leftnav element inside the Toolbar block, it is currently inside the sidebar.main, I have tried:
<referenceBlock name="catalogsearch.leftnav.clone">
        <action method="setTemplate" ifconfig="layered_navigation/general/enable">
            <argument name="template" xsi:type="string">layer/view-clone.phtml</argument>
        </action>
        <container name="layer.additional.info" as="layer_additional_info"/>
        <container name="layer.content.before" as="layer_content_before"/>
    </referenceBlock>

<move element="catalogsearch.leftnav.clone" destination="content" before="product_list_toolbar_pager"/>

but it has not worked, since I have left the element inside content but not inside the Toolbar, any suggestions?
Thanks!


texts: Page rss feeds display error on line 1 at column 1: Document is empty

texts:
I am using magento 1.9.2.4. I enabled rss feeds(New Products, Top Level Category) from the admin pannel. The rss feed for new products is working fine. But when I open any category rss page it display error as show in the picture.
the url open is like that .
https://example.com/rss/catalog/category/cid/56/store_id/1/


texts: Hide MORE INFORMATION tab if it's empty in magento 2.3

texts:
Want to hide More Information tab under catalog product view in Magento 2.3 if it's empty.
Not sure where to start, below is screenshot,

I use M2.3 and theme is Porto (if that's necessary to know) I checked under /var/www/html/vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml but not sure if this is where I need to make changes. Any help would be appreciated!


texts: Magento2: How to update the product price programatically

texts:
I am using the below code to update the price but the price is not changing.

  $objectManager  = \Magento\Framework\App\ObjectManager::getInstance();
  $product       = $objectManager->create('\Magento\Catalog\Model\Product');
  $product->load($productId);
  $product->setPrice($productData['price']);
  $product->save();


texts: SQL Error when adding simple products to bundle

texts:
I'm trying to add simple products to a bundle in Magento, but I'm getting an SQL error whenever I try. The specific error I'm getting is

  SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
  update a child row: a foreign key constraint fails
  ('magento'.'catalog_product_relation', CONSTRAINT
  'FK_CAT_PRD_RELATION_CHILD_ID_CAT_PRD_ENTT_ENTT_ID' FOREIGN KEY
  ('child_id') REFERENCES 'catalog_product_entity' ('entity_id') ON
  DELETE CASCAD), query was: INSERT INTO 'catalog_product_relation'
  ('parent_id','child_id') VALUES (?, ?)

So essentially, when trying to add a new row to catalog_product_relation, for each product I try to add, rather than the bundle and simple product ID's it's using ?,?.

This is quite a large bundle with over 250 simple products spread across 10 categories, I've checked the catalog_product_relation table and there's no unexpected rows, and I've made sure all products are available in this store/website and are enabled, is anyone able to shed any light on why it's passing through these blank values?

EDIT: It seems that after having successfully added two or three simple products without getting the SQL error, 20 products which were previously saved without issue have disappeared from the bundle, their empty categories are still there however


texts: Bank Details On Success Page of Magento 2

texts:
If the payment method is bank transfer, I need to show a custom message on success page of Magento 2.

I'm going to say

  "don't forget: we will ship to you after your payment received to our
  bank account; here are our bank details; and you have 2 days left to
  make your payment"

etc..

I found the solution as like below (with editing success.phtml), but you know, I don't want to edit core files.

<?php if ($this->getOrderId()):?>
<div class="bank_detail">
<?php $orderId = $this->getOrderId(); ?>
<?php $order = Mage::getModel("sales/order")->loadByIncrementId($orderId); //load order by increment id?>
<?php $paymentCode = $order->getPayment()->getMethod(); ?>

   <?php if ($paymentCode=='banktransfer') {
       echo "whatever you want!";
   } //you can also check for other payment method?>

Could someone help me to do this with the module?


texts: In Magento2 UpgradeSchema, Don't we have addColumns to add more columns to a table?

texts:
In Magento2 UpgradeSchema we have a function as,

$setup->getConnection()->addColumn(
        $setup->getTable('quote'),
        'testColumn',
        [
            'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            'length' => 32,
            'nullable' => false,
            'default' => '',
        ]
    );

to add columns to the existing table. But if we want to add more than 1 column to a existing table do we have any options like,

$setup->getConnection()->addColumns(
        $setup->getTable('quote'),
        'testColumn1',
        [
            'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            'length' => 32,
            'nullable' => false,
            'default' => '',
        ],
        'testColumn1',
        [
            'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
            'length' => 32,
            'nullable' => false,
            'default' => '',
        ]
    );

instead of doing addColumn more than 1 time.


texts: Why is Magento Creating Files with 666 Permissions?

texts:
Magento creates all new files with 666 permissions. It is driving me nuts trying to figure out how to stop this behavior.

I've set up Nginx & php5-fcgi on Ubuntu 14.04 to operate as follows:

Owner: someuser
Group: www-data

Nginx is operating as www-data. Chmod recursively on /var/www 660 for files and 770 for directories.

I set group bit (+s) so that all files belong to group "www-data". 'Someuser' belongs to this group. This allows me to upload / edit files as someuser while letting www-data have full access to them.

I installed ACL and ran this command:

setfacl -R -d -m u::rwx,g::rwx,o::--- /var/www

I've confirmed the ACL and group bit is set properly for new files that I create myself. I also created a PHP script to create some new files and confirmed that PHP is creating files with correct permissions (660).

So everything seems to be set up properly, except Magento insists on creating files with 666 permissions. There are numerous places in Magento where it sets umask to 0. I'm not sure if this is the source of the issue.

Otherwise I have no idea. Any ideas why this is happening?


texts: Magento 2. Custom text in place of Price is not working Properly

texts:
In custom module I hide the Price and in the place of Price I tried to show Custom text it work perfectly but in some Categories it shows the custom text twice e.g men, Women. I can show the details in image and also going to upload the code as well thanks in Advance

In other categories it shows the "For any Quaries Contact US" only once as you can see in the image.

but in "Men" and "Women" categories they show it twice as you guys can see it in image now my code is

  PME\Hideprice\Plugin

<?php

namespace PME\Hideprice\Plugin;

use PME\Hideprice\Helper\Data as Helper;

    class Price
    {

        public function __construct (
            Helper $helper,
            array $data = []
        ) {
                $this->helper = $helper;
        }

        function afterToHtml(\Magento\Catalog\Pricing\Render\FinalPriceBox $subject, $result) {
            // echo $this->helper->isCustomerLoggedIn(); exit;
            if($this->helper->getIsEnable())
            {
                if(!$this->helper->isCustomerLoggedIn())
                {
                    return "
For any Quaries Contact Us
";
                }
            }
            return $result;
        }

    }

  etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">

        <type name="Magento\Catalog\Pricing\Render\FinalPriceBox">
            <plugin name="price_hide" type="PME\Hideprice\Plugin\Price"/>
        </type>

</config>


texts: How to fetch all products from one magento website and insert them into other

texts:
I want to fetch all products from one magento website to insert them into other magento installation.
I've gone through google  and got confused on which methods I should use and which are all the methods I can skip. I need it to be done pragmatically

Can anyone streamline the ideas and give me a solution?


texts: How to use addFieldToFilter() in field generated in sql?

texts:
If I try to filter a field in the existing table works, but a field generated by max () does not work, even renaming,  display the error getBackend().

Examples:

observer

$collection->getSelect()->columns(array('last_order' =>
            new Zend_Db_Expr ("(SELECT MAX(created_at) FROM " .
            $collection->getTable('sales/order') . " WHERE customer_id = e.entity_id)")));

grid - _prepareCollection()

$this->getCollection()->addFieldToFilter('last_order', 1);

I was wondering how can I make this filter work with my select


texts:
I am working with the image upload,i want to get the renamed images for save into my table.

    original file name : t h i r d_i_m_@g e(1).jpg
    renamed file name : 1435902886t_h_i_r_d_i_m__g_e_1_.jpg(in folder)

Code

    $uploader = new Varien_File_Uploader($field_name);
            $uploader->setAllowedExtensions($extension);
            $uploader->setAllowCreateFolders(true);
            $uploader->setAllowRenameFiles(true);
            $uploader->save($path,$fname);

When I print $uploader the result is:

    Varien_File_Uploader Object
    (
        [_file:protected] => Array
            (
                [name] => t h i r d_i_m_@g e(1).jpg
                [type] => image/jpeg
                [tmp_name] => /tmp/phpkUUDen
                [error] => 0
                [size] => 37994
            )

        [_fileMimeType:protected] =>
        [_uploadType:protected] => 0
        [_uploadedFileName:protected] => 1435904665t_h_i_r_d_i_m__g_e_1_.jpg
        [_uploadedFileDir:protected] => /home/vhosts/FederalLawyer/media/lawyer/news/image/
        [_allowCreateFolders:protected] => 1
        [_allowRenameFiles:protected] => 1
        [_enableFilesDispersion:protected] =>
        [_caseInsensitiveFilenames:protected] => 1
        [_dispretionPath:protected] =>
        [_fileExists:protected] => 1
        [_allowedExtensions:protected] => Array
            (
                [0] => jpg
                [1] => png
                [2] => gif
                [3] => jpeg
            )

        [_validateCallbacks:protected] => Array
            (
            )

        [_result:protected] => Array
            (
                [name] => t h i r d_i_m_@g e(1).jpg
                [type] => image/jpeg
                [tmp_name] => /tmp/phpkUUDen
                [error] => 0
                [size] => 37994
                [path] => /home/vhosts/FederalLawyer/media/lawyer/news/image/
                [file] => 1435904665t_h_i_r_d_i_m__g_e_1_.jpg
            )

    )

From this how can I get the renamed file name?


texts: Magento 2.2.2 Web Setup Wizard not visible in backend on Nginx and php7


texts: How to add grand totals excl in magento 2 checkout cart

texts:
I want to add grand totals exc in Magento 2 checkout cart. Like cart summary in checkout payment step.

Checkout payment step.

Checkout cart.

UPDATE IMAGE


texts: Create/Update static block programmatically in magento2

texts:
I am trying to create/update static block programmatically with recurringData.php from setup script.

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Model\GroupFactory;
use Magento\Cms\Model\BlockFactory;
class RecurringData implements InstallDataInterface
{

protected $storeManager;
protected $_objectManager;
private  $blockFactory;
protected $_urlInterface;
protected $state;

public function __construct(

    \Magento\Store\Model\StoreManagerInterface $storeManager,
    \Magento\Framework\ObjectManagerInterface $objectManager,
    BlockFactory $blockFactory,
    \Magento\Framework\UrlInterface $urlInterface,
    \Magento\Framework\App\State $state
) {
    $this->storeManager = $storeManager;
    $this->_objectManager = $objectManager;
    $this->blockFactory = $blockFactory;
    $this->_urlInterface    = $urlInterface;
    $this->state = $state;
}

  public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
  $storeId = $this->storeManager->getStore()->getId();
   $customBlock= $this->blockFactory->create()->setStoreId($storeId)->load('test-block', 'identifier');
      $objectManager  = $this->_objectManager;
       $media_dir = $objectManager->get('Magento\Store\Model\StoreManagerInterface')
         ->getStore()
         ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
                $Image = $media_dir."test.png";

                $contentBlock = [
                    'title' => 'Test Block',
                    'identifier' => 'test-block',
                    'stores' => $storeId,
                    'is_active' => 1,
                    'content' => '

Static Block

Testing

checking data

',
                    'sort_order' => 0
                ];
                if (!$customBlock->getId()) {
                    $this->blockFactory->create()->setData($contentBlock )->save();
                } else {
                    $customBlock->setContent($contentBlock ['content'])->save();
                }
    }
  }

Here I have already block with same identifier and i am trying to update the content of it, I am getting below error.

  A block identifier with the same properties already exists in the selected store.

Am i used the correct code?  Can anyone help me to implement it. Thanks


texts: Adminhtml Catalog Product Edit Tabs Sorting Order

texts:
I'm looking to add a new tab to the adminhtml catalog product edit page on the left side. I've gone through and followed this tutorial, and my new tab is showing up correctly on the left side.

http://www.phpcmsframework.com/2012/12/magento-steps-to-add-custom-tabs-to.html

What I'm looking to do now, though, is change the sorting order of those tabs so mine is not last on the list. This is something that was not covered in the tutorial, and I have not been able to find anything online or in the code to point me in the right direction. Any suggestions appreciated!


texts: Magento2: How can I create a validation for telephone inputs inside Magento Admin?

texts:
I have to create a validation for the telephone inputs in Magento Admin. I need to set a min of characters like 8 and a max of 15. I'm currently using 2.2.8 version.

I tried to set the validation by admin using telephone attribute, but it didn't work. It inserts a class for validation but doesn't validate at all.

Thanks!


texts:
How do i get product category url and name on product detail page?

<a href="<?php echo $helper->categoryAttribute($product, $product->getCategory(), 'url'); ?>">
    View All
    <?php echo $helper->categoryAttribute($product, $product->getCategory(), 'name'); ?>


texts: Adjust Columns width/size in Product Grid in Magento Admin

texts:
I just wonder why the size/width in Product Grid in the admin panel is not adjusting. I created a local copy of the grid.php from the core file. I tried editing the sizes of the column (/app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php) but when I try to refresh the admin page nothing happens. I cleared the cache still the same the width are the same.

Can anyone guide me how to increase the width size of every column?

EDIT:
In addition, is there a way I can the FROM and TO in the PRICE and QTY Column? How?


texts: Magento - updated category, missing thousands of products

texts:
Recently updated a category in our Magento install (adjusting title and meta data)

We have 1 main category, with 8 sub categories. Each of these sub categories had around 1000 - 3000 products in each.

After said update of category, our top 5 categories are now showing only 1000 products, the products are still in the database, just not assigned to a category.

Has anyone experienced this before? Is it a server timeout issue when re-indexing?

We're running 1.8.0.0.

Thanks for any help/advice.


texts: How can i show additional information of a product on a seperate page through coding

texts:
Can anybody please help me to provide a code that show the additional information of a product on a sepecrate page...

If there is any php code, please let me know so i can use that..

I am not fiding any proper code..

IF possible how can i change this code in a way that i can use it on any seperate page against a specific product id.

<?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct()
?>
<?php if($_additional = $this->getAdditionalData()): ?>

<?php echo $this->__('Additional Information') ?>

        <col width="25%" />
        <col />

        <?php foreach ($_additional as $_data): ?>

                <?php echo $this->escapeHtml($this->__($_data['label'])) ?>
                <?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?>

        <?php endforeach; ?>

<?php endif;?>

Please help me..

Thanks in advance...


texts: How disable the module related to path Enterprise/GiftWrapping/Helper/Data.php

texts:
Recently we are getting the following warning. What is this? How to avoid it as it makes the log very big.

ERR (3): Warning: include(Enterprise/GiftWrapping/Helper/Data.php):
failed to open stream: No such file or directory  in
/magento/installation/path/lib/Varien/Autoload.php on line 94.


texts: How to get list of users who didn't place on order in the past year

texts: We want to get a list of users who didn't place an order in the past year, so we can send out a promo code for them. What is the best way to get this list from magento? I am not interested in just code solutions, if you know any premium extensions that have this feature  it would be great (I couldn't find any)


texts: Magento2 production mode error magento2.1

texts:
I got below error on my category pages and product pages after setting minify html to yes:

  Parse error: syntax error, unexpected ‘<‘, expecting end of file” magento2 production mode

What should i do?


texts: Magento 2 getData() Not showing attribute values

texts:
I am trying to get category_ids  but below code working for me.
but print_r($collection->getData()); Not showing attribute values but in foreach data is there.

foreach ($collection as  $product) {
   print_r($product->getCategoryIds()); // this is working fine
}

my code to get collection

   protected $_productCollectionFactory;

   public function __construct( .....
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
                          ....

            .....
            $this->_productCollectionFactory = $productCollectionFactory;
            ......
    }

    $collection = $this->_productCollectionFactory->create()->addAttributeToSelect(array('category_ids'));


texts: CSS and JS not loading after installing Magento 2, setup:static-content:deploy shows error

texts:
I have recently installed Magento2. CSS and JS not loading after installing Magento 2. I have used composer to install. This magento 2 files I have taken by a checkout from a live website.

Also the php magento setup:static-content:deploy command is not working. Running this command gives the following error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/mongo.so' - /usr/lib/php5/20131226/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0 Could not open input file: magento


texts: Magento2: Eav atrribute magento2 equivalent

texts:
What is the equivalent Magento 1 :

$tmp = new Mage_Catalog_Model_Resource_Eav_Attribute();

in Magento 2?


texts: Magento2: Customer name is not showing on product page

texts:
When the cache is enabled customer name is not showing on the product page.

When the cache is disabled customer name is showing properly on the product page.

header.phtml

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**
 * @var \Magento\Theme\Block\Html\Header $block
 */

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');

//$welcomeMessage = $block->getWelcome();
?>

<a href="<?php echo $block->getUrl('about-us'); ?>">About Us

<a href="<?php echo $block->getUrl('contact-us'); ?>">Contact Us

<a href="<?php echo $block->getUrl('sales/order/history'); ?>">My Orders

<a href="<?php echo $block->getUrl('wishlist'); ?>">Wish List

<a href="<?php echo $block->getUrl('ordertracking'); ?>">Track Order

<?php echo $this->getLayout()
    ->createBlock('Codism\Csr\Block\Index\TopMenu')
    ->setTemplate('Codism_Csr::menu.phtml')
    ->toHtml();
?>

<?php if($customerSession->isLoggedIn()) {?>

Hi, <?php echo $customerSession->getCustomer()->getName(); ?>

<?php }?>

Screenshot


texts: How to Know that on which channel the coupon has been used in Magento?

texts: How we can check that on which channel the coupon has been used. Web or mobile in Magento?


texts: Checking for previous orders on success page

texts:
I'm trying to do a lookup on the success page to see if a customer has placed an order before. Many of the solutions I have found were checking against a customer ID, which is fine if you're only interested in logged in customers.

However, I want to check on the email address because we also use a guest checkout so some customers may have previously ordered.

I'm using the following code to set the cust_type value that I want to send through to some order tracking script to show whether someone has placed an order before or not.

I'm also noticing (I think), that if someone is placing their first order, then by the time we get to the success page the Order Collection would return 1 for getSize because it would include the order they have just placed, which I need to ignore to ascertain if they have ordered with us before;

<?php

$_customer = Mage::getSingleton('customer/session')->getCustomer();
$_customerId = Mage::getSingleton('customer/session')->getCustomerId();

$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$_orderData = $order->getData();
$_grand_total = number_format((float)$_orderData['grand_total'], 2, '.', '');
$_qty_total = round($_orderData['total_qty_ordered']);

if(Mage::getSingleton('customer/session')->isLoggedIn()){
    //If logged in, get Customer email
    $customerEmail = $_customer->getEmail();
}else{
    //If not logged in, get Email from Order
    $customerEmail = $order->getCustomerEmail();
};

$_previousOrdersCheck = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('entity_id')
    ->addFieldToFilter('customer_email', $customerEmail)
    ->setCurPage(1)
    ->setPageSize(1)
    ->getFirstItem();

if ($_previousOrdersCheck->getSize()) {
    $cust_type = 2;
}else{
    $cust_type = 1;
};

?>


texts: Adding a new method to an Abstract Class in Magento 2

texts:
Like this thread said: Override abstract class in Magento 2 in Magento 1,

I can just create a full new class.
In Magento 2, we need to use plugins, but plugins only allow me to modified existent methods. What i have to do if I want to add a new method?

Example:

This class vendor/magento/module-ui/Component/AbstractComponent.php, has an array of components: $components, there is no function to unset/delete elements for that array. So how can I create that function?


texts: Magento 2 getPriceInfo returns the same price for every product in collection

texts:
I'm building a widget which displays a given number of products based on the Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory collection factory and I try to get the correct prices for every product inside the factory but somehow this results in all products showing the same price as the first product. All products have catalog rules applied to them and every product is a simple product.

Everything except the product price related values are returning correct values.

I'm using the following code:

namespace ActiveAnts\Bestsellers\Block\Widget;

use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Model\ProductRepository;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Element\Template;
use Magento\Reports\Model\ResourceModel\Report\Collection\Factory;
use Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory;
use Magento\Widget\Block\BlockInterface;

class Bestsellers extends Template implements BlockInterface
{
protected $_template = 'widget/bestsellers.phtml';

protected $_productsCount;
protected $httpContext;
protected $_resourceFactory;
protected $_productCollectionFactory;
protected $_imageHelper;
protected $_cartHelper;
private $_productRepository;
private $_collectionFactory;

/**
 * Bestsellers constructor.
 * @param Context $context
 * @param Factory $resourceFactory
 * @param CollectionFactory $collectionFactory
 * @param ProductRepository $productRepository
 * @param array $data
 */
public function __construct(
    Context $context,
    Factory $resourceFactory,
    CollectionFactory $collectionFactory,
    ProductRepository $productRepository,
    array $data = []
) {
    $this->_resourceFactory = $resourceFactory;
    $this->_imageHelper = $context->getImageHelper();
    $this->_cartHelper = $context->getCartHelper();
    $this->_collectionFactory = $collectionFactory;
    $this->_productRepository = $productRepository;
    parent::__construct($context, $data);
}

/**
 * get featured product collection
 */
public function getBestsellerProduct()
{
    $objectManager = ObjectManager::getInstance();

    $collection = $this->_collectionFactory->create()->setModel(
        'Magento\Catalog\Model\Product'
    );

    $collection->setPageSize(15);

    foreach ($collection as $item) {
        $_product = $objectManager->get('Magento\Catalog\Model\Product')->load($item->getProductId());

        $_productRepo = $this->_productRepository->getById($item->getProductId());

        $bestsellers[] = [
            'id' => $item->getProductId(),
            'store id' => $item->getStoreId(),
            'product_url' => $_productRepo->getUrlModel()->getUrl($_productRepo),
            'addtocart_url' => $this->_cartHelper->getAddUrl($_product),
//                'price' => $objectManager->get('Magento\Catalog\Model\Product')->load($item->getProductId())->getPriceInfo()->getPrice('final_price')->getAmount(),
            'price' => $_product->getPriceInfo()->getPrice('final_price')->getAmount(),
            'price_html' => $this->getLayout()->getBlock('product.price.render.default')->render(
                'final_price',
                $_product
            )
        ];
    }
    return $collection;
}
}

I've been trying to fix this for 3 days now without any luck, so any answers that give me a push in the right direction would be awesome, thanks!


texts: Magento 2 - Product list template not override with set template

texts:
Template doesn't set from my block.

My di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Block\Product\ListProduct" type="Kite\Boxes\Block\Rewrite\Product\ListProduct" />
</config>

My Block File is,

<?php

namespace Kite\Boxes\Block\Rewrite\Product;

class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
    protected function _construct()
    {
        $this->setTemplate('Kite_Boxes::catalog/product/list.phtml');
    }
}

Error occurred like,

Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Catalog\Block\Product\ListProduct::__construct() must be an instance of Magento\Catalog\Block\Product\Context, none given, called in /var/www/vhosts/goweb-dev01.site/httpdocs/var/generation/Kite/Boxes/Block/Rewrite/Product/ListProduct/Interceptor.php on line 14 and defined in /var/www/vhosts/goweb-dev01.site/httpdocs/vendor/magento/module-catalog/Block/Product/ListProduct.php:66 Stack trace: #0 /var/www/vhosts/goweb-dev01.site/httpdocs/var/generation/Kite/Boxes/Block/Rewrite/Product/ListProduct/Interceptor.php(14): Magento\Catalog\Block\Product\ListProduct->__construct() #1 /var/www/vhosts/goweb-dev01.site/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(73): Kite\Boxes\Block\Rewrite\Product\ListProduct\Interceptor->__construct() #2 /var/www/vhosts/goweb-dev01.site/httpdocs/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Kite\\Boxes\\Bloc...', Array) #3 in /var/www/vhosts/goweb-dev01.site/httpdocs/vendor/magento/module-catalog/Block/Product/ListProduct.php on line 66

Does anyone have idea about this problem?


texts: Doubt/Query/Clarification Regarding, Custom Payment Gateway Integration

texts:
I am using Magento 2x and trying to integrate a Payment Gateway called Telr.

The issue I am facing with it is, an Order Confirmation Email is being sent the moment the customer is being redirected to Payment Gateway irrespective of the Order being Failed, Cancelled, Successful etc.

I reported the same to the Payment Gateway Company (Telr). But they said this is a flaw from Magento itself.

Then I showed them that they were wrong by using PayPal Express Checkout & Braintree Payment. Both the payment gateway worked fine, as expected, i.e, Order Confirmation Email was only being sent once the Order was SUCCESSFUL, and not immediately after being redirected to Paypayl, as it's happening with Telr. I demoed the same to them with the help of a Test Transaction via screencast.

They are still in DENIAL and saying that they cannot use Paypal's workflow as it will cause a MAJOR SECURITY LOOPHOLE. Please check attached image for screenshot of their response Email.

It would be GREAT HELP, if anybody could confirm whether what Telr is saying is TRUE OR NOT. AFAIK this isn't true.

Thanks.


texts:
I'm trying to understand how the entire header section is put together, and wanted to move some things around just to try to understand how Magento is putting everything together.

How could I accomplish these changes without using any css as the main change maker? I'm looking for more of how to get these divs moved on the DOM structure then use css on top.

For example, the minicart moved up to the very top right; the logo moved to the center; the search box to the left; and main nav to the right.

I would like to completely redefine/restructure the entire header/navigation section. These don't have to make sense aesthetically, it is just for learning purposes.

Any feedback, resources, and/or help is much appreciated!


texts: How to prevent Magento 2 from changing file permissions?

texts:
We are working on local environments to do our developments and we don't want Magento 2 to change file permissions - actually, we think that Magento 2 should never change file permissions, it's not its responsibility to handle filesystem strategy.

How can we do that? Currently, Magento 2 keeps on updating file ownership and permissions.


texts: Magento 2.3.4 Could not save product "id" with position 0 to category (id of category)

texts:
I have this strange issue with magento 2.3.4.

although I have already this patch Magento official patch

which claims that it solve this I keep having this issue with duplicate urls in my database.

This happened after we insert new products with duplicating old ones. When we duplicate a product and then need to unassign one category we get error:

  Could not save product "id" with position 0 to category id

and product can't saved.

If we go to same category and try to remove product from there we get:

  Something went wrong. Please try again later

and error in exception:

[2020-03-06 14:26:52] report.CRITICAL: Could not save product "40003" with position 0 to category 1674 {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): Could not save product \"40003\" with position 0 to category 1674 at /myfolder/public_html/vendor/magento/module-catalog/Model/CategoryLinkRepository.php:90, Magento\\UrlRewrite\\Model\\Exception\\UrlAlreadyExistsException(code: 0): URL key for specified store already exists. at /myfolder/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:304, Magento\\Framework\\Exception\\AlreadyExistsException(code: 0): URL key for specified store already exists. at /myfolder/public_html/vendor/magento/module-url-rewrite/Model/Storage/DbStorage.php:337, Magento\\Framework\\DB\\Adapter\\DuplicateException(code: 1062): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link.html/mylink.htm' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/wpaper/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:585, Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link.html/mylink.htm' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO `url_rewrite` (`redirect_type`,`is_autogenerated`,`metadata`,`description`,`entity_type`,`entity_id`,`request_path`,`target_path`,`store_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?) at /home/wpaper/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'link.html/mylink.htm' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID' at /home/wpaper/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"}

If you check previous error you will see that the link is:

  link.html/mylink.htm

we use html at the end. I don't know why this error say htm

What we tried:

1.We used modules even paid for regenerate url rewrite table

2.We made a script and resave all products in our catalog

Nothing helped. After a while we have this issue again

Any ideas?


texts: How is the order attached to newly created customer after checkout

texts:
Hey I hope this question isn't to broad but how is the order attached to a customer that is created after guest checkout?

Background to my question:
I want to attach a custom field to my customer. This custom field is acquired in checkout and stored in the order. I tried to receive the order in a observer watching the customer_register_success event:

namespace Vendor\CheckoutCustomerInfo\Observer;

use Magento\Customer\Model\Customer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface;

class AddInfoFromOrderToCustomerObserver implements ObserverInterface
{

    private $collectionFactoryInterface;

    public function __construct(CollectionFactoryInterface $collectionFactoryInterface)
    {
        $this->collectionFactoryInterface = $collectionFactoryInterface;
    }

    /**
     * @param Observer $observer
     *
     * @return void
     */
    public function execute(Observer $observer)
    {
        /**
         * @var Customer $customer
         */
        $customer = $observer->getCustomer();

        $orders = $this->collectionFactoryInterface->create($customer->getId())->addFieldToSelect(
            '*'
        )->setOrder(
            'created_at',
            'desc'
        );
    }
}

But in $orders I do not have the order.

Am I doing something wrong with querying the orders of the customer or is it attached somehow different? Is this event to early to get the order?

Thanks in advance!


texts: magento 2 - category attribute with checkbox input throws exception on admin save

texts:
I created an InstallData class to add category attribute with checkbox input type.

$eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'attribute_id', [
'type'     => 'int',
'label'    => 'Your Category Attribute Name',
'input'    => 'checkbox',
'source'   => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
'visible'  => true,
'default'  => '0',
'required' => false,
'global'   => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'group'    => 'Display Settings',
]);

The attribute displays a checkbox properly on the admin category edit page, but saving the category does not save checked value. If I change the input type to 'boolean', catch error - "Class boolean doesn't exist". How can I fix it to save checkbox value?


texts:
Situation

We are using m2epro in version 6.3.7 on a magento 1.9.0 and we are facing a little problem with mapping phone numbers from ebay to magento orders. In Ebay the information is setup with a non prefixed phone number, like in the first image (Ebay: Buyer details).

However, in magento orders the phone number is replaced with the bogus value of 0000000000, as shown in the second image (Magento: Sales > Orders).

This holds for both; the shipping and the billing address.

Analysis

As we understand it correctly, ebay orders are delivered in a two step process which moves data through m2e before they end up in magento: ebay --1--> m2e --2--> magento. Thus, the phone number must being corrupted somewhere in step 1 or 2. Nonetheless, we assume the error occurs in step 1, because the orders in m2e all have an Invalid Request set as their Telephone number as in the image (Magento: Sales on ebay > Sales > Edit shipping address):

Code Reference

Searching this bogus value in the m2e codebase, reveals three possible reads in following Files:

\Ess_M2ePro_Model_Buy_Order_ShippingAddress
\Ess_M2ePro_Model_Ebay_Order_ShippingAddress
\Ess_M2ePro_Model_Amazon_Order_ShippingAddress

Code

Each of these reads set '0000000000' as the default phone number, when the phone otherwise would be equal to the empty string ''.

private function getPhone()
{
    $phone = $this->getData('phone');

    if ($phone == '') {
        $phone = '0000000000';
    }

    return $phone;
}

Question

Does anybody have encountered a similar problem before and knows a solution to this? So, if there is a valid1 phone number present in ebay, that it is delivered correctly to magento? Any debugging suggestions are welcome as well, e.g. : Is it anyhow possible to configure the m2e logging, so that it outputs errors numbers returned by calls to the ebay APIs?

1valid: a phone number with or without prefix, not being empty.

Research

The changelog on m2e doesn't include any fixes on this behalf. Looking for answers on the stackexchange networks didn't match anything useful either.


texts: Product review form with image field Magento 1.9.2.4

texts: How to get product review form with image field section in View page review section


texts: This is a static block code, I want to hide this static block for smaller screen devices and I applied this styling and used the hidden feature of bootstrap to it but it won't work. Any ideas why this isnt working?


texts: fully customize theme or inherit from parent theme in magento2.0.1?

texts:
My requirement is making one eCommerce site which totally different from magento luma/blank . I stuck with how to utilize theme in magento 2. In most of the tutorial inherit parent theme.

which is the best way to achieve look and feel which totally different from Magento Luma/Blank and why ?

the options are

Inherit parent theme(luma or blank)
Without inherit parent theme (fully customize)


texts: How to convert template variables to custom data in magento 2

texts:
I have configured a back-end screen where I will enter a string as

{{price}} for guest user. click here {{sign_up}}.

So after I fetch the field value I want to dynamically replace the {{price}} variable to some custom price and {{sign_up}} to a cms page link.

Can anybody help me on how to do this?
thanks


texts: What is difference between files in Block and files in Layout folder?

texts:
I am a newbie in Magento and its very confusing.
I read files for view come from Layout folder , then i read somewhere that view is managed by files in Block folder.What is true ? Its totally confusing.If there is PHTML file for view (HTML) , what is purpose of layout XML file ??

Thanks !


texts: Create Magento 2 Bundles with different quantities of the same product

texts:
I'm currently running Magento 2.3.2. The Company I work for sells a number of products in bundles of varying quantities which we call "Stacks".

For example a product can be sold in bundles of either 1, 3 or 6. The price drops more as the customer orders a larger "stack".

The problem is that I can only seem to add the product once in each option, I really need it in the same option several times at different quantities.

I assume that there are probably extensions out there that can help with customizing bundle options but it really seems like this is should be a standard feature so I wondered if there was a way to do this "out of the box" as it were.

Can anyone suggest how to do this please?


texts:
I have generated google site map in magento but the url links are from old server

It is showing links from my old server now i have moved my files to another server but generated map contains old files


texts: After importing products from excel logging out

texts:
I import products from an excel file. After everything passes I do not get any errors. The table with catalog products looks like this:

I have hidden the names of the products, but all products have names. I run indexer-reindex and flush the cache. After I refresh the page the strangest thing happens. When I click on some of the new products that I've just imported it automatically logs me out and redirects me to the login screen for the admin panel. If I click on some of the old products that I've imported manually - I can go and edit the product as expected.

Anyone has any idea why ?


texts: Magento 2.3.3: Creating customer address in admin shows no countries or wrong countries in dropdown

texts:
I have just one country allowed in configurations. If I try to create new address for customer in admin, the country dropdown does not show any countries, not even one. I can't save the address, because country is required selection.

If I allow let's say 10 countries in configurations, it now shows 10 countries, but not the ones I allowed in configurations. It shows first ten countries from Magento's country list.

In customer account in frontend the correct countries are shown and it even works with only one country allowed in configurations.


texts: How to get acces to block parameters defined in XML layout in block class

texts:
I am wondering how I can get access to parameter for blocks I define in a layout.xml

My cms_index_index.xml is as follows:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="intro.main.top">
            <container name="intro.main.top.container" htmlTag="div" htmlClass="intro-main-top-container" before="-">
                <block class="Test\PromoBanners\Block\Container"
                    name="ambanners.test.home.primary" template="container.phtml">
                        <arguments>
                            <argument name="position" xsi:type="string">20</argument>
                        </arguments>
                </block>
                <block class="Test\PromoBanners\Block\Container"
                    name="ambanners.test.home.primary.sidebar" template="container.phtml">
                    <arguments>
                        <argument name="position" xsi:type="string">25</argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>
    </body>
</page>

In the two blocks I pass position as an argument.

In the container.phtml I have access to position with just calling $this->getData('position). But in my block class I do not.

My `Blocks\Container.php:

<?php

namespace Test\PromoBanners\Block;

use Test\PromoBanners\Model\Banner\Data;
use Magento\Catalog\Model\Layer\Resolver;
use Magento\Framework\View\Element\Template;

class Container extends Template
{
    private $layerResolver;

    private $bannerModel;

    private $banners;

    public $positions;

    public function __construct(
        Template\Context $context,
        Resolver $layerResolver,
        Data $bannerModel,
        array $data = []
    ) {
        $this->bannerModel = $bannerModel;
        $this->layerResolver = $layerResolver;
        $this->banners = $this->getBanners();
        $this->positions = $this->getData('position');
        parent::__construct($context, $data);

        var_dump($this->positions) // dumps nothing
    }
}

I need the position parameter to do some logic with and looking up other blocks. Something I do not want to do in the container.phtml file.


texts:
Hello guys I want to print meta keyword value of a product. How can I achive this? I tried this but It doesnt work :

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

edit: OK guys I realized that I didnt get productid dynamically so I fixed the problem. Thank you guys!


texts:
Downloadable products are having issue.

After purchasing downloadable product, its links goes to email-id of Buyer.
When a buyer clicks on that link, product is downloading but its size is 0 KB !

No update or edit done in the code. i can download the file directly. it may be max_execute_time setting or any other server setting ?


texts: Cron error on line 240 from Mage/Core/Helper/Abstract.php

texts:
I will start by saying that I have not overwritten any core files (except the one noted below), and have disabled my theme. I'm am currently running on stock Magento 1.9.1. My website is not live, and I am accessing it via a modified hosts file to redirect my computer.
One thing that does concern me is that the server I'm installed on is running PHP version 5.2.17 natively. So in order to install Magento 1.9.1 I used PHP variable manager from Cpanel to set each of the top folders (app, downloader, media, skin, var, etc) .httaccess file to PHP 5.5. Everything has been working fine until I went to run cron.
I have left the cron settings in the back of magento as default, and have set cron in cpanel to run every 5 minutes.
My first issue was that cron would not launch. After looking online I saw that a known bug required

$isShellDisabled = true;

to be entered on line 49 in cron.php.I did this and cron started running. However it does not complete, and gives this error message.

Parse error: syntax error, unexpected T_FUNCTION in /home/*******/public_html/app/code/core/Mage/Core/Helper/Abstract.php on line 240

After looking online I saw that some say this is caused by wrong PHP version; however I also saw how some said the lines of code causing the error could be rewritten in a different way. I tried the code rewrite; however I then began getting multiple errors in lib/Pelago/Emogrifier.php. The errors were because of this "/" throughout the code. See below examples of the type of code syntax that was causing the errors.

throw new \InvalidArgumentException
throw new \BadMethodCallException
$xpath = new \DOMXPath($xmlDocument);

I also got several errors of the same style as the one from mage/core/helper/Abstract.php.
Once I saw how many errors I was getting in this file, I realized that rewriting code was not the answer, and something must be setup wrong.
The only thing I can think of is that cron isn't functioning without the website being live? Or I'm having issues with my version of PHP? However my products, menus, transactional emails, ups shipping estimates, everything else is working.
Any ideas to point me in the right direction would be greatly appreciated!


texts: Magento2: value_index in configurable product API

texts:
In official REST API guide Step 4. Define configurable product options, there are payload like below.

{
  "option": {
    "attribute_id": "141",
    "label": "Size",
    "position": 0,
    "is_use_default": true,
    "values": [
      {
        "value_index": 9
      }
    ]
  }
}

Other parameters I can understand, but what is the function of value_index?

The guide just said

  The value assigned to the value_index must be unique within the system.

I have huge configurable products to create by the API, how can I make sure the value_index different in each creation?


texts: We had to do a restore from a month-old backup, now there is a conflict with order numbers. How to set Order numbers to be issued higher?

texts:
Magento 1.9.1
Porto theme

We had to do a complete restore from a month old backup. Now there is a problem with Paypal versus the Order numbers because Magento is assigning the Order numbers that we already used/assigned in the month since.

How can I set Magento to start assigning order numbers from a higher number (to skip a thousand or so)?


texts: new adminhtml theme does not show in deploy list

texts:
Using Magento 2.1.1, I would like to deploy a new adminhtml theme in cli.
magento setup:static-content:deploy --theme Tc/theme.
Result:
[InvalidArgumentException]
  Tc/theme argument has invalid value, available themes are: Magento/blank, M
  agento/luma, Magento/backend, Venustheme/need

I follow this link to craete my theme Create a new storefront theme. After magento setup:upgrade, Tc/theme is added to database theme and parent_id is pointing to Magento/backendHere are my codes

composer.json

{
    "name": "magento/theme-adminhtml-backend",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/framework": "100.0.*"
    },
    "type": "magento2-theme",
    "version": "100.0.5",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'adminhtml/Tc/theme',
    __DIR__
);

theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Magento 2 - backend</title>
    <parent>Magento/backend</parent>
 </theme>

What I want to do is to custom the phtml in adminhtml. Please help. Thanks.


texts: Magento 2 show shipping according to categories

texts:
Is there a way or it is possible like this -

Suppose 2 categories Category A and Category B

Category A products have always shipping with USPS and inside further conditions -

1 - If the order total price is less than $25 then show USPS -

USPS First Class mail letter & USPS First class mail postcards

2 - If order total price is greater than $25 then show USPS -

USPS Priority mail hold for pickup & USPS Priority mail smallflat rate box

Category B products have always shipping with UPS and inside further conditions -

1 - If the order total price is less than $25 then show UPS -

UPS standard & UPS Ground

2 - If the order total price is greater than $25 then show UPS -

UPS next day air & UPS second day air.


texts: Get product image url of specific store view with or without https

texts:
i have to call an ajax request from an external website which (the
simple way) returns the link to an product image of a store view i
added to the request. The problem is, that the following function
call always returns the path from the default store view, cause the
request is to the default store.

$this->helper('catalog/image')
    ->init($product, 'image')
    ->keepFrame(false)
    ->resize(250);

If the calling site is a https site, the website can't show the image, because it's loaded from a non https site.

So there are two questions:

How can i load an image path of a specific store view id?
How can i load the image path with the secure base url?

Thanks in advance for any help!