texts: Widget: Get Filter item URL *without* current URL context

texts:
I'm currently building a multi-list of product filter options which will have lists of current attribute values, and sit in the main navigation menu, such as this:

Color       Animal     Foo
---------   --------   ---------
Red         Cat        Foo
Blue        Dog        Bar
Green       Snake      Foobar

However, whenever I call getUrl() on the filter item, it adds the filter item option with the options already in the URL. E.g.,

Current URL: example.com/cat/red.html

And if I then want to click on Bar, it will give me: example.com/cat/red-bar.html instead of just example.com/bar.html.

My current code is below; help, what am I doing wrong/need to do!?

class ExampleWidget extends Template implements BlockInterface
{
    protected $_template = "widget/examplewidget.phtml";

    public function __construct(
        Template\Context $context,
        \Magento\Framework\ObjectManagerInterface $objectManager,
        \Magento\Catalog\Model\CategoryFactory $categoryFactory,
        \Magento\Catalog\Model\Layer\Category\FilterableAttributeList $filterableAttributeList,
        \Magento\Catalog\Model\Layer\Resolver $resolver
    ) {
        $this->_categoryFactory = $categoryFactory;
        $this->_filterableAttributeList = $filterableAttributeList;
        $this->_resolver = $resolver;
        $this->_objectManager = $objectManager;
        parent::__construct($context);
    }

    public function getCategoryAttributeOptions($categoryId, $attrinuteName)
    {
        // Get the attributes that are filterable
        $filterList = $this->_objectManager->getInstance()->create(
            \Magento\Catalog\Model\Layer\FilterList::class, [
                'filterableAttributes' => $this->_filterableAttributeList
            ]
        );

        // Filter to just this category
        $layer = $this->_resolver->get();
        $layer->setCurrentCategory($categoryId);
        $filters = $filterList->getFilters($layer);

        $options = [];
        foreach ($filters as $filter) {
            // We don't want this attribute
            if ($filter->getName() != $attrinuteName) {
                continue;
            }

            // Don't show options with no items
            if (! $filter->getItemsCount()) {
                continue;
            }

            foreach ($filter->getItems() as $item) {
                $options[] = [
                    "label" => $item->getLabel(),
                    "url" => $item->getUrl()
                ];
            }
        }

        return $options;
    }


texts: I want to share product with product image and details on social media websites

texts: I am working on product share part within Magento. As per link product link only get shared on social website. I want to share product with its image and details.


texts:
We have a indexer in Magento 2.3.3 that is giving us a difficult time.

We tried many times reset and reindex that indexer but does not help.

  | Bol.com Offer Export        | Ready            | Schedule  | idle
  (11619 in backlog) | 2020-01-18 19:31:42 |

So this is from extension https://marketplace.magento.com/honl-bol-com-retailer.html

We tried many times :

php bin/magento indexer:reset bol_offer_export

and then

php bin/magento indexer:reindex bol_offer_export

But no luck at all. Any ideas on this ?


texts: Magento2 Zend Pdf draw png images not working

texts:
I want to print png images in pdf not working

it gives error Only non-interlaced images are currently supported

how to solve this ?

$directImagePath = "C:/xampp/htdocs/magento232/pub/media/catalog/product\cache\fb8aff55bb3a38ad97f984d002bf3a6d\//c/o/cool-background1.png"
$image = \Zend_Pdf_Image::imageWithPath($directImagePath);


texts: put country dropdown in phtml file in magento2

texts:
sayhello.phtml

<!DOCTYPE html>

Wholesale and Dealer Inquiries Form

<form action="<?php echo $block-
>getBaseUrl().'wholesaleapplication/index/post/';?>" method="post">

         Business Name
         <input type="text" name="name">

          Contact Name
         <input type="text" name="cname">

           E-mail
         <input type="email" name="email">

           Address
         <input type="text" name="address">
          Street Address

         <input type="text" name="address2">
          Street Address  line 2

         <input type="text" name="city">
         city
         <input type="text" name="state">
         state/province

         <input type="text" name="zipcode">
         postal zip/code

         <input type="text" name="areacode">
         area code
         <input type="text" name="phonenumber">
         phone number

           Website
         <input type="text" name="website">

           Reseller Permit
         <input type="text"  name="reseller">

           Description of Business
         <textarea  name="description" ></textarea>

           Additional Questions and Comments
         <textarea name="additional"  ></textarea>

           click to edit
         <input type="file">

     <button  type="submit" name="submit">
          Submit
        </button>

</form>

country dropdowncode

<?php $_countries =
Mage::getResourceModel('directory/country_collection')
loadData()
toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
<select name="country" id="country">
    <option value="">-- Please Select --</option>
    <?php foreach($_countries as $_country): ?>
        <option value="<?php echo $_country['value'] ?>">
            <?php echo $_country['label'] ?>
        </option>
    <?php endforeach; ?>
   </select>
 <?php endif; ?>

i want drop down near zip code in phtml file where to keep this country code?


texts: Connect Manager not showing some extensions

texts:
After installing a few extensions, they for some reason don't show up in the Connect Manager. Modules like: M2E, Jemoon_Htmlminify, Lest_FPC, PulseStorm_Launcher, etc.

They are all installed, but they are not listed there. And when I try and upgrade them (by installing them again via Connect Manager), I get this error:

  CONNECT ERROR: Package 'm2epro_ebay_magento' is invalid
  './app/code/community/Ess/M2ePro/Block/Adminhtml/Account/Grid.php'
  already exists

It then halts my magento installation, until I delete the file maintenance.flag in my magento folder.

I've tried running:

./mage sync but it's not working.

What's going on here? I'm running Magento 1.9


texts: Search product show after customer login in Magento 2. Without login no product views to customer on search in website and  it redirected  on customer login


texts: How to show/hide UiComponent form field on based of new/edit mode

texts:
I want to show shortcode field once record inserted. else on new record is should be hidden.

Ui Component form field xml:

       <field name="shortcode">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="visible" xsi:type="boolean">false</item>
                    <item name="disabled" xsi:type="boolean">true</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Shortcode</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">banner</item>
                    <item name="sortOrder" xsi:type="number">10</item>
                    <item name="dataScope" xsi:type="string">shortcode</item>
                    <item name="notice" xsi:type="string" translate="true">Copy this shortcode to CMS Block/Page to show banner slider</item>
                    <item name="component" xsi:type="string">Rchauhan_BannerSlider/js/form/element/toggle-checkbox-category</item>
                </item>
            </argument>
        </field>

toggle-checkbox-category.js:

define([
    'jquery',
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/text',
    'Magento_Ui/js/modal/modal'
], function ($, _, uiRegistry, textbox, modal) {
    'use strict';

    return textbox.extend({
        /**
         * Choose notice on initialization
         *
         * @returns {*|void|Element}
         */
        initialize: function (value) {
            this._super();

            setTimeout(function () {
                let field1 = uiRegistry.get('index = entity_id');
                let field2 = uiRegistry.get('index = shortcode');

                if (field1.getInitialValue()) {
                    field2.show();
                } else {
                    field2.hide();
                }
            }, 2000)

            return this;
        },

        /**
         * On value change handler.
         *
         * @param {String} value
         */
        onUpdate: function (value) {
            var field1 = uiRegistry.get('index = entity_id');
            var field2 = uiRegistry.get('index = shortcode');

            console.log(field1.getInitialValue());

            if (field1.getInitialValue()) {
                field2.show();
            } else {
                field1.hide();
            }

            return this._super();
        },
    });
});

Any suggestions would be welcome. Thanks.


texts: How to create a menu with category created in new template

texts: I installed this template http://magento2.flytheme.net/themes/sm_shop4u/default and i followed this step : http://documentation.flytheme.net/sm-shop4u/#themesetting but ia m not getting my menu and can you please explain to me the meanning of data type when chosing category ??? i am really lost please if any one have an experinec with this template please help me and thanks in advance


texts: Which price to set, if there is not (yet) a price?

texts:
In Magento it is not possible to set a price = 0.

But there might be cases where data is not yet complete (when developing a shop) - or products are not for sale (i.e. some custom block is displayed)

What is a reasonable value to set as price?

I think a very high one if more secure than 0.01 ?


texts: Error link admin when install Magento 2.1 sample finish!

texts:
When finish install Magento sample 2.1, i visit the following link admin:

http://magento21_sample.m:8012/admin/

then redirect link:

http://magento21_sample.m:8012/admin/http:/index/magento21_sample.m:8012/admin/admin/index/index/key/a9afc5f3ca6ea7547fe61e05d3b43258c6e5c34ab485986aebbe1a388e44c97a/

and not connect.

After, i run link: http://magento21_sample.m:8012/
I see a lot of error not found in console:

GET http://magento21_sample.m:8012/pub/static/frontend/Magento/luma/vi_VN/mage/calendar.css 404 (Not Found)
(index):22 GET http://magento21_sample.m:8012/pub/static/frontend/Magento/luma/vi_VN/mage/requirejs/mixins.js
(index):21 GET http://magento21_sample.m:8012/pub/static/frontend/Magento/luma/vi_VN/requirejs/require.js
(index):126 GET http://magento21_sample.m:8012/pub/static/frontend/Magento/luma/vi_VN/images/logo.svg 404 (Not Found)
(index):22 GET http://magento21_sample.m:8012/pub/static/frontend/Magento/luma/vi_VN/mage/requirejs/mixins.js 404 (Not Found)

Help!!!


texts: Magento2 : Google map API json file decode using curl

texts:
hello this is phtml file

<?php $address=$_GET['location'];//manhattan

$address = str_replace(" ", "+", $address);
 $url="https://maps.google.com/maps/api/geocode/json?address=$address&key=".$block->getApiKey();
echo $url;

from above code i am getting this url

if hit that url in  browsers other tab it will display json data i.e https://maps.google.com/maps/api/geocode/json?address=Manhattan&key=AIzaSyBr3mn7y42_iHMTcE_5zEJk_uSGCFXIFGk

i have to fetch that data in php variables mainly longitude and latitude for setting in my map any suggestion

any help will be appreciated thanks


texts:
I have below code. I'm overriding Paypal Express 1 function.

magento\app\code\Custom\Module\Model\Api\Nvp.php

namespace Custom\Module\Model\Api;

class Nvp extends \Magento\Paypal\Model\Api\Nvp {

    public function getPaymentAction() {
      // Here need to show error message & redirect to checkout page
      return $this->_getDataOrConfig('payment_action');
    }
}

I have 2 issues. When i create constructor it keeps giving error this object is missing & how to redirect from here?

Don't want to use direct objectManager in Method. Would like to above things

protected $_checkoutSession;

public function __construct(\Magento\Checkout\Model\Session $checkoutSession) {
    $this->_checkoutSession = $checkoutSession;
}

By putting above code it gives below error

  Incompatible argument type: Required type:
  \Magento\Customer\Helper\Address. Actual type: array;


texts: Magento CE 1.9 multiple addAttributeToFilter to get products in phtml page

texts:
I have some php code I am trying to use to get a listing of product names based on specific criteria. That criteria is the status of the product is enabled and the visibility is set to either catalog or catalog,search  My issue is the below code gives me an error that says "Fatal error: Call to a member function getBackend() on a non-object in public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816";

   $allProduct = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter(array(
array(
    'attribute' => 'status',
    'eq'        => 1),
    ),
array(
    'attribute' => 'visibility',
    'eq'      > '1',
    ),
));
$product_media = Mage::getModel('catalog/product_media_config');
$temp = "";
$itemCounter = 0;
$currentItem = 0;
$currentItemName = $_helper->productAttribute($_product, $_product->getName(), 'name');
foreach($allProduct as $p){
    $tempName = $product_media->getMediaUrl($p->getNailImage());
    if($currentItemName == $p['name']){
        $currentItem = $itemCounter;
    }
    $itemCounter++;
    if(!$p['rgba']){
        $p['rgba'] = '666';
    }

However the below code works except for it lists all products that are enabled. I just am trying to add the visibility filter to my above code.

   $allProduct = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('status', array('eq' => 1));
$product_media = Mage::getModel('catalog/product_media_config');
$temp = "";
$itemCounter = 0;
$currentItem = 0;
$currentItemName = $_helper->productAttribute($_product, $_product->getName(), 'name');
foreach($allProduct as $p){
    $tempName = $product_media->getMediaUrl($p->getNailImage());
    if($currentItemName == $p['name']){
        $currentItem = $itemCounter;
    }
    $itemCounter++;
    if(!$p['rgba']){
        $p['rgba'] = '666';
    }


texts: Shopping cart price rule - How to make customer be able to choose which promotion they want?

texts:
By default, if both Promotion A & Promotion B can be apply to cart, it will be applied automatically.

I need to custom magento shopping cart price rule to make customer be able to choose which promotion they want. In checkout cart page, customer must see 2 checkbox of promotion A & B to choose only one of them.

How can I do that ? I really appreciate your help.


texts: Magento 2.3.3 + elasticsearch 6 - empty catalog. Elasticsearch adds WHERE (NULL) to product collection

texts:
I have elasticsearch 6.8 and M2.3.3.
On the both category and search pages Magento display:
We can't find products matching the selection.
(MYSQL engine works correctly)
Reindex and cache are refreshed. I also added 2 patches:
https://github.com/magento/magento2/issues/27112#issuecomment-748916677
https://devdocs.magento.com/guides/v2.3/release-notes/release-notes-2-3-3-open-source.html#apply-the-catalog-pagination-issue-on-elasticsearch-6x-patch-to-resolve-a-critical-search-result-pagination-issue
Elasticseach is configured properly:
curl -X GET http://elasticsearch:9200/test_product_1_v15/_search?q=sergei
{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":4.255225,"hits":[{"_index":"test_product_1_v15","_type":"document","_id":"246","_score":4.255225,"_source":{"store_id":"1","sku":"Sergey","status":"1","status_value":"Enabled","visibility":"4","name":"Sergey","category_ids":[2,52,84,125],"position_category_2":"0","name_category_2":"Test Category","position_category_52":"0","name_category_52":"Test Category 2","position_category_84":"0","name_category_84":"Test Category 3","position_category_125":"0","name_category_125":"Test","price_4_1":"80.000000","price_0_1":"100.000000","price_1_1":"100.000000","price_2_1":"100.000000","price_3_1":"100.000000","price_5_1":"100.000000","price_6_1":"100.000000"}}]}}

Here is the final SQL query from list.phtml - it contains strange condition WHERE (NULL)
SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IFNULL(review_summary.reviews_count, 0) AS `reviews_count`, IFNULL(review_summary.rating_summary, 0) AS `rating_summary` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
 LEFT JOIN `review_entity_summary` AS `review_summary` ON e.entity_id = review_summary.entity_pk_value AND review_summary.store_id = 1 AND review_summary.entity_type = (SELECT `review_entity`.`entity_id` FROM `review_entity` WHERE (entity_code = 'product')) WHERE (NULL)

Without this condition all seems fine.
I logged collection in this method (I suppose it's elasticsearch output(?)):  \Magento\Elasticsearch\Model\Layer\Category\ItemCollectionProvider::getCollection()
and WHERE (NULL) already here:
SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (NULL)

Any ideas why elastic search adds this condition and how can I rightly discard it?
If elastic search (magento extension) adds NULL because the answer from elastic search is empty, how can I debug it in magento?


texts:
I am new on magento and after instal magento 1.9.3 I facing with following problems:

First Issue: If I set catalog as grid view the cart text and price are over the short description;
Second Issue: in the list view mode the product picture not displaying correct ratio. My theme is rwd (default 1.9.3) enclosed pictures or my web address www.agroimpex.ro


texts: Size selection is not displayed, returns text Size

texts:
I created a configuration product and attached simple products with dimensions to it. When switching to a product, the selection of sizes is not displayed, but the text is displayed.

How can this be fixed?


texts: How can we associate simple product to bundle product programmatically in Magento 2

texts:
I have added bundle product programmatically by using below code but how can i associate a simple product to bundle product programmatically.

    /** @var $objectManager \Magento\TestFramework\ObjectManager */
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager
$state = $objectManager->get('Magento\Framework\App\State');
//$state->setAreaCode('frontend');
$_product = $objectManager->create('Magento\Catalog\Model\Product');
$_product->setCategoryIds(array(3,5));
$_product->setName('Test Product6');
$_product->setTypeId('bundle');
$_product->setAttributeSetId(4);
$_product->setSku('test-SKU6');
$_product->setAttributeSetId(11);
$_product->setWebsiteIds(array(1));
$_product->setVisibility(4);
$_product->setPrice(array(1));
$_product->setImage('/testimg/test.jpg');
$_product->setSmallImage('/testimg/test.jpg');
$_product->setThumbnail('/testimg/test.jpg');
$_product->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$_product->setStockData(array(
        'use_config_manage_stock' => 0, //'Use config settings' checkbox
        'manage_stock' => 1, //manage stock
        'min_sale_qty' => 1, //Minimum Qty Allowed in Shopping Cart
        'max_sale_qty' => 2, //Maximum Qty Allowed in Shopping Cart
        'is_in_stock' => 1, //Stock Availability
        'qty' => 100 //qty
        )
    );

$_product->save();

I have tried this answer but i am getting error

Help would be appreciated.


texts:
After many months we have reached our frustration point with our Magento 2 migration path - it's a long sad story for a separate thread - so we are seriously considering instead a lightweight custom frontend using our existing Magento 1.7.x database / admin backend.

The benefits we see:

Reduced risk: Existing backend/admin continue to work as usual. No data migration necessary. No staff retraining. Consideration for a future date migration to 1.9.x is a much smaller risk than Magento 2.
Improved developer experience: We understand our use case and don't need the kitchen sink of flexibility that Magento framework offers and the burden that goes with such. We want an F5 - or livereload - experience that computes under a second, a directory structure with a max depth of 2 or 3, and just simple code.
Easier to recruit non Magento developers: As we are considering either PHP + a MVC framework, or Node.js  - with session sharing code, and nginx/haproxy handling the backend split - The talent pool of either seems larger than those with Magento specific experience. We also hope this converts to saner estimates time wise when we need to outsource, we've been getting ridiculous quotes for even the most basic of tasks recently.

So at high-level our implementation plan is to handle in our custom frontend - the homepage and other CMS pages, collectively the category, search result and listing page, and the product detail page. These parts are essentially read-only at the request level - excluding recently viewed, logging and session concerns. We will maintain a flat fast read no-EAV database of information required for these parts, for now we have built a one time sync for testing but will probably rely on triggers, or some form of mysql notify  or even code an observer with the m1.7 backend to populate this fast read db as information changes.

We intend to utilize the existing cart, checkout, and account management, and postpone the rewrite, if ever, for these parts to stage 2. Accessing the M1.7 session state was an easy spike outside of Mage::app.

We prototyped the most difficult part early this week - the listing page that touches products (stock, images, parent relationships), category, attributes sets, attributes, and even a third party Amasty plugin for 'better navigation', and it was quite a smooth experience, performant, and almost identical in functionality - we didn't replicate Amasty bugs though.

So it's been a interest week, we go carefully..

Of course we must consider the risk, some things that have come up in discussion:

How can we keep our lightweight frontend simple enough that a new developer can pick it up in a morning, do we risk creating a system like Magento without any community, documentation, third party support
If we add a new Magento functionality via a module, how much burden are we shouldering by having to implement the frontend part ourselves. Stakeholders have already mentioned a new coupon plugin.
Can we always figure out the intent from the backend and database tables? Many plugins are obfuscated.
The time saved is it then spent on documentation and other unconsidered pitfalls.

Have anyone attempted or even considered a custom frontend for Magento before? What were the pitfalls you encountered? What other considerations would you factor into a decision like this?


texts: Magento WYSIWYG editor image upload not working

texts: Hello EveryoneI have a problem with my WYSIWYG editor in magento admin. When I try to upload image or video, it processes the image. Then shows 100% upload complete message. After that nothing happens. The image is not uploaded and it doesn't show in the list.I have no idea how this happened. It was working before but now it just doesn't.I don't know what caused the problem or how to solve this. Does anyone have any idea??Thanks in Advance.


texts: Filter sales/order collection according to country

texts:
I would like to filter out my home country (GB or United Kingdom) from the following sales/order collection. How can this be done?

$orders = Mage::getModel('sales/order')->getCollection()
        ->addFieldToSelect('entity_id')
        ->addFieldToFilter('status', 'complete')
        ->setOrder('created_at', 'desc')
            ->setPageSize(40); // Last 40 Orders


texts:
I am aware about using basic GIT and running basic commands but dont know how to start. Start meaning dont know how to integrate on local with online.

https://docs.nexcess.net/article/what-is-git.html

https://blog.nexcess.net/2011/09/11/source-control-with-git/#disqus_thread

I am using nexcess shared hosting for my project and read above articles too.

So what are initial steps to integrate?
Do my nexcess cpanel-user will be GIT-user for accessing ?

EDIT:

I have same concern like this post but could not get how to start?

Thanks for any help provided my any source.


texts:
I have a configurable product that has a few custom options.(i.e. custom text, font color) The product can be ordered with custom text on it and custom font color. What I am trying to achieve is, if the color of the product is black, I want to hide 'black' from the font color custom options drop down list.

Basically I need to set up some rules so that the customer does not order a dark colored product and also attempts to have a dark font color printed on it. What would be the best direction for me to take on achieving this?


texts:
I'm trying to add a stylesheet to the very bottom of the loaded stylesheets, and am having a hard time figuring out the best way to do it.

I tried using this extentension:

https://github.com/drewhunter/ItemPosition/blob/master/modman

Which seems like it should work, but doesn't quite do it. If I add the 'setLastItem' method to the bottom of my page.xml head block, any css from other modules is added after the 'last' item set.

It would be great to have a weight associated with a stylesheet - so you could declare something like this in the layout:

<action method="addCss">
  <stylesheet>put_me_at_the_end.css</stylesheet>
  <weight>1000</weight>
</action>

But even then, you'd still need all of the css to be aggregated through all the extensions and then weighted...


texts: How to log a message when logging turned off in configuration

texts:
I am debugging some custom code on the live high traffic Magento 1.9 site.

I don't want to turn on logging in System > Configuration > Developer > Log Settings as the log file is filling up with messages so fast I can't see my debug message.

Is there a command that will log a message with logging turned off?


texts: how to fix console error in magento 2.2.6?

texts:
How to fix jquery console error in magento2.2.6?
please check attached screenshot http://prntscr.com/ld1s8k.


texts: Magento1.9 : order by Zend_Db_Expr showing error while reindexing catalog_product_flat index

texts:
I have created a custom script to display products on home page filter by product ids.

$_productCollection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('*')
                ->addAttributeToFilter('entity_id', array('in' => $product_ids))
                ->addAttributeToFilter('status', array('eq' => 1))
                ->addAttributeToFilter('visibility', 4);

But products showing on frontend in entity_id (ASC) orders. To order by product_ids array I found below code and it is working :

$_productCollection->getSelect()->order(new Zend_Db_Expr('FIELD(entity_id, ' . $product_ids.')'))

But whenever php shell/indexer.php -reindex catalog_product_flat index is in processing this line shows error on frontend there has been error processing your request.

This error still coming If catalog flat tables setting are disabled in admin panel and no index is in processing state.

Why this is happening?


texts:
how I can get all attributes that used for creating a configurable product?
did we have API for this?
 and how we can create configurable attribute by admin panel


texts:
I would like to know how members of the community are approaching the storage of the M2 codebase (ex: git) and sql dumps for scalability and quick deployments (also allowing for quick rollbacks).

I have seen approaches that store the M2 codebase in one repository, and then the custom code in another repo, and the two are connected via git submodule functionality.
I have seen an approach which uses composer artifacts to bundle up custom modules.
Then there is another which is to just commit all generated code to the repo.
Finally, I've seen a suggested method from Alan Kent: https://alankent.me/2016/03/31/m2-project-source-code-management-recommendation/. Although this would require db upgrade/code generation/static content & di deployment for each push to a server (this isn't ideal for hot fixes, quick updates, etc).

I would appreciate any and all feedback from those that work at agencies, extension developers, and in-house developers.


texts: Magento Order submit Invoice fails and gives strangest error

texts:
My client's site is running on Magento ce-1.9.2.1.

Now he says for a particular order, whenever he tries to Generate invoice and then submit the same, he gets below error, which even I found for the first time:

We were not able to recognize the list of articles in this order. Please make sure that the article numbers match the order and try again.

Please advise and suggest something about this.


texts: how to properly serialize / unserialize magento 2 models to json format

texts:
I'm trying to retrieve some data from a controller in a serialized format that I can unserialize later. For example, I have created an entity with the following data fields

MyEntity

entity_id
identifier
created_at
updated_at

In my controller's execution method I retrieve the list of results based on my criteria.

Now I would like to return a JSON response serialized object in this format

{result:[{'entity_id': 'id', 'identifier': 'identifier'},{...},{...}]}`

I'm trying to use the SerializerInterface to do this

serializer->serialize($item)

but serializing the entities gives empty values like this which is my first issue.

{"result":[{},{},{},{}]}

Later on, in another controller, I would have loved to do the following based on the results retrieved from the first controller which is my second issue.

unserialize($response->getBody()->getContents()->result)

And give me an array of MyEntity items

MyEntity[]

In Symfony, I can already do this using the serializer component which is very powerful and allows me to group attributes I want to expose and also ignore things I don't want to expose so I guess I'm looking for something similar. Is there a Magento 2 implementation for this?

https://symfony.com/doc/current/components/serializer.html

After further digging I noticed that the serializer for json executes a simple json_encode so there probably isn't any standard implementation for serializing/unserializing an object. The best I could do to serialize the Model was to implement in my model the \JsonSerializable interface like this

 public function jsonSerialize()
    {
        return [
          self::KEY_KEY => $this->getData(self::KEY_KEY),
          self::KEY_IDENTIFIER => $this->getData(self::KEY_IDENTIFIER),
          self::KEY_NAME => $this->getData(self::KEY_NAME),
          self::KEY_DESCRIPTION => $this->getData(self::KEY_DESCRIPTION),
        ];
    }

I would love to be able to utilize a framework method to do this though so I'm still looking for an answer to this as well as to how to decode the serialized string back to the Object's Class.


texts: Magento 2 Cron Run throws PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface

texts:
So when I run the php bin/magento cron:run I get error as PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface
This error gets disappear after two times I run the cron:run In my local Magento 2.3.4 setup. But unfortunately in Cloud Instance this error persist forever. So looking for the solution.
The below code in my custom module cron.php file which is scheduled as * * * * *
public function __construct(
    \Magento\Framework\Filesystem\DriverInterface $driverInterface,
...
) {
        $this->_fileDriverInterface = $fileDriverInterface;
...
}

I have found in local If I run php bin/magent setup:upgrade I get this error for two time while running cron:run as mentioned above. After that it works.
Anyone has idea about this error?


texts: Magento 2 - How to add new action type in shopping cart rule

texts:
I want to add New action type Name = Buy 1 get 1.

If anyone gets 1 product and cart rule condition true then I give one free product to that order.

How to add the new action to cart rule. and how to calculate that cart rule.

Does have any solution for this?


texts: Add a static/hardcoded price if textfield contains text

texts:
I have a textbox that is shown on some products so that people can type a name or word that they want engraved onto the item they are buying. Now my issue is if they type something in the textbox and click add to cart I need a hardcoded price added ontop of the products base price. So say the item is $100.00 and they type a word in the textbox and click add to cart the item should then have its price changed to $106.99

My issue is I am not sure how to go about changing the products price if a textbox contains a value.


texts: Magento 2.1 custom theme (Login and Registration Form)

texts:
I have successfully created Magento using/ inherited from Blank default theme. When I remove the default css

<remove src="css/styles-m.css" />
<remove src="css/styles-l.css" />

I see the login and registration form appears on the home page. How do I remove them using referenceBlock. Also, if I remove them will these be available via http://www...com/customer/account/login/


texts:
Im using this code in a CMS page under design> custom layout update XML

<reference name=”head”>
    <action method=”setForcedTitle”><title>Account Dashboard</title></action>
</reference>

When I try to update the page, I get this error

XML Data is Invalid.

Im using code from this guide.

http://www.harapartners.com/blog/complete-guide-title-tags-magento/

I have looked at several other sites to find out how to do this, and they all say to use this code.

Any ideas as to why this is happening?


texts: Just installed magento 2 on centos OS having problems with setting permissions for new user. The only apache group I get is nobody. So I've added the user to that group but cant set any permissions. Any ideas?


texts: If the attribute has "No" or not filled out, then do not display for bundled product

texts:
I'm currently displaying a block that has a custom attribute for simple products. But, I don't want to display it for grouped products, only for simple products.

In Manage Products > Custom Attribute I set everything to be blank for just that attribute. I would like Magento to not show the custom attribute tab if the setting is blank or 0.

Perhaps it could be an If statement and hook a display none tag to it? Here is the line I'm looking at that might be useful

<?php if ($attributeValue === 'No' || strpos($_data['code'], '(dv)')) continue; ?>

Thanks in advance!


texts: How to run my custom code before a cron job (catalogrule_apply_all) WITHOUT overriding Magento's core?

texts:
Plain and simple: my module must do stuff before Magento's own catalogrule_apply_all (meaning: Mage_CatalogRule_Model_Rule::dailyCatalogUpdate()).

I see no event rised neither in this method itself nor in its invoked method Mage::getSingleton('catalogrule/rule')::applyAll().

I'd strongly would prefer NOT to override the module because... this is a awful practice.

So... is there a way to run my code before a Magento's other job without overriding?


texts: Magento 2 : Sub Categories not Showing in Layared Navigation

texts:
I have install Magento 2.1.3 with Porto Theme.

In category page, Few sub category display proper with products count and Faw doesn't appare/display but it has product.

I tried to disable all custom modules and tried to disable Porto Theme but not display other sub-categories.

Following file from vendor/magento/module-catalog-search/Model/Layer/Filter/Category.php

protected function _getItemsData()
{
    /** @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $productCollection */
    $productCollection = $this->getLayer()->getProductCollection();
    $optionsFacetedData = $productCollection->getFacetedData('category');
    $category = $this->dataProvider->getCategory();
    $categories = $category->getChildrenCategories();

    $collectionSize = $productCollection->getSize();

    if ($category->getIsActive()) {
        foreach ($categories as $category) {
            if ($category->getIsActive()
                && isset($optionsFacetedData[$category->getId()])
                && $this->isOptionReducesResults($optionsFacetedData[$category->getId()]['count'], $collectionSize)
            ) {
                $this->itemDataBuilder->addItemData(
                    $this->escaper->escapeHtml($category->getName()),
                    $category->getId(),
                    $optionsFacetedData[$category->getId()]['count']
                );
            }
        }
    }

I debug above code and found that, $this->isOptionReducesResults($optionsFacetedData[$category->getId()]['count'], $collectionSize) getting blank so that sub-categories not showing.


texts:
For filtering attributes, I use the method geturl() in order to get the required url a client side input type component should use in order to call the server and activate the required filtering via the defined controller .
For attribute :

$items = $this->_filter->getItems();
    $filterValues = [];
    foreach ($items as $item) {
                   $filterValueData["filter_url"] = $item->getUrl();
}

How can this please be preformed for a sorting attribute for example price or date ?
I currently create those urls manually - for example : ?creation_date=asc


texts: How to change Buttons color in Magento2?


texts: Set product image using custom code in magento

texts:
i want to set the product image from my folder.For that i am doing like this but no luck.

$image =  Mage::getBaseDir('media') . DS ."users/a.jpg";
$product = Mage::getModel('catalog/product')->load($product_id);
$product->setSmallImage($image)
    ->setThumbnail($image)
    ->setImage($image)
    ->save();

Also try like this :

if(is_file($image))
{
    $product->addImageToMediaGallery($image, array ('image', 'small_image', 'thumbnail'), false, false);
}

What i miss ? thanks for the help


texts: How to remove validation error message upon input field change?

texts:
I have installed a module that adds another payment method, which has additional input options, and I want to make those options mandatory.

I've added a validator to validate #co-payment-form's input fields, as described in Magento's docs – Add custom validations before order placement.

I have added these attributes to the <select> element: data-validate="{required:true, 'validate-select':true}" and class="select validate-select".

And the validator looks like this:

define([
    'jquery',
    'mage/validation'
], function ($)
{
    'use strict';
    return {
        paymentFormSelector: '#co-payment-form',
        validate: function ()
        {
            const jqPaymentForm = $(this.paymentFormSelector).validation();
            return $(jqPaymentForm).valid();
        }
    };
});

Now, when I do not select anything and click on "Place Order"/"Submit Order", this validator gets called all right and the field gets a red error message.

How do I remove the message once the user has selected something?

I see that, for example, the mandatory fields of the shipping address form get all red upon trying to place an order, but once I start writing in such a field, the error message disappears at once.

How can I get the same for this custom validator?


texts: SQLSTATE[42S02]: Base table or view not found: design_config_grid_flat

texts:
Good morning,

I'm using magento 2.1.9 and yesterday I did a backup recovery, but now when I try to access to;

Content/Design/Configuration

the following error appears;

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

How can I fix this error?

Thank you!


texts: Can't create Magento custom admin module

texts:
I've trying for many hours to create a custom admin module but no luck so far. Here's my code:

/app/code/local/CompanyName/MailView/etc/config.xml:

<?xml version="1.0"?>
<config>
 <modules>
   <CompanyName_MailView>
    <version>0.1.0</version>
</CompanyName_MailView>
</modules>
<admin>
<routers>
    <adminhtml>
       <!-- <use>admin</use>          -->
        <args>
            <modules>
                <mailview before="Mage_Adminhtml">CompanyName_MailView</mailview>
            </modules>
        </args>
    </adminhtml>
</routers>
</admin>
<global>
<helpers>
    <companyname_mailview>
        <class>CompanyName_MailView_Helper</class>
    </companyname_mailview>
</helpers>
</global>
</config>

/app/code/local/CompanyName/MailView/etc/adminhtml.xml

  <?xml version="1.0"?>
 <config>
<menu>
    <companyname translate="title" module="CompanyName_mailview">
        <title>View Emails</title>
        <sort_order>999</sort_order>
        <action>adminhtml/mailview/index</action>
    </companyname>
</menu>
  <acl>
    <resources>
        <admin>
            <children>
                <CompanyName translate="title" module="companyname_mailview">
                    <title>Top Level Pulse Storm Menu Item</title>
                    <sort_order>1</sort_order>
                     <children>
                        <example>
                            <title>Example Menu Item</title>
                        </example>
                    </children>
                </CompanyName>
            </children>
        </admin>
    </resources>
</acl>
  </config>

and here's my controller: app/code/local/CompanyName/MailView/controllers/MailViewController.php:

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

and my helper: app/code/local/CompanyName/MailView/Helper/Data.php

<?php
 class CompanyName_MailView_Helper_Data extends
 Mage_Core_Helper_Abstract
{
 }

The module appears in the admin panel. When I click on it though I get an error 404 page not found.

I've been following this tutorial but no luck so far. What am I missing here?  Thank you


texts: How to create a ssl for magento 2.4 localhost

texts: I want to install magento 2.4 in localhost, but it is asking for elastic search and ssl, now how to create a ssl for local server.


texts: SQL query to find what products do not have status set

texts:
For some reason some products we have entered using a custom product importer have not had status set, and as such we cannot find them in the backend but they are there in the database.

I want to find an SQL query that will give me all product entity ids where no status has been set.

Simplification of catalog_product_entity:

| entity_id | ... |
| 988       | ... |
| 999       | ... |
| 1000      | ... |

Simplification of catalog_product_entity_int:

| entity_id | attribute_id | value | ... |
| 988       | 96           | 1     | ... |
| 999       | 12           | 0     | ... |
| 1000      | 96           | 2     | ... |
| ...       | ...          | ..    | ... |

So in that example, products 988 and 1000 have an entry for attribute_id= 96 (which is the attribute_id for status), but 999 does not. It is the ID 999 I want to find with my SQL query.

SELECT `catalog_product_entity`.`entity_id`, `catalog_product_entity_int`.`attribute_id`
FROM `catalog_product_entity`
LEFT JOIN `catalog_product_entity_int`
ON (`catalog_product_entity`.`entity_id` = `catalog_product_entity_int`.`entity_id`)
WHERE `catalog_product_entity_int`.`attribute_id`=96
AND `catalog_product_entity`.`entity_id` IS NULL

But this query is not working correctly because the row does not exist for the product in the first place.

Could someone help me out with another query? I know this is basic SQL but I thought it might be helpful for other Magento users trying to find how status is not set.

I have also tried to get the products using the Magento collection method (->addAttributeToFilter('status',array('null' => true))) but this does not work, again because I think the status record has not been created for the product.

If I can get the IDs with a direct SQL query, I will then load them the 'Magento' way and resave them with a status.

Thanks.


texts: How to add Brand Slider In navigation menu (dropdown menu)

texts: I am using Magento 1.9 and I want to add brand slider in navigation menu. Anyone know how to do it ? or how can I display images in navigation menu as Dropdown menu ? i want as shown in pic, Guide me,Its urgent


texts: Magento2: How to create a cron Job and make to run daily

texts:
I have created a Module, Now I wanted that module or controller to run daily once.

I have created below Code.

  \app\code\Autosynch\synchProduct\etc\crontab.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="custom_AutoSynch_cronjob" instance="Autosynch\synchProduct\Cron\Test" method="execute">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>
</config>

How can I start cron job Manually ?

where can I check that this job is working and can I write any success or error messages ?


texts:
I need to apply sorting on Review list by Highest Rating and Lowest rating. I searched but not find any solution for that.

Can anyone has idea how can i apply sorting on Highest Rating and Lowest rating on Review List.

Thanks in advance.


texts: The above image is of top-links. I wanted to add a drop-down for My Account. When the user click or hover on it, My Account should show My account option For example orders.


texts: I attempt to make a full system backup through the admin but it just says please wait for a couple minutes and then doesn't appear to have made a backup. How do I fix this?


texts:
I want to modify all css files in path:
app/code/Aheadworks/Autorelated/view/frontend/web/css

What is the best way to do it?


texts: Multiple Image upload restrict up to 10 images

texts:
How to add multiple image upload in magento 2 and restrict to only 10

  <field name="images">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">default_image</item>
                <item name="label" xsi:type="string" translate="true">Image</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="validation" xsi:type="array">
                    <item name="required-entry" xsi:type="boolean">true</item>
                </item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="celebrities/image/upload"/>
                </item>
            </item>
        </argument>
    </field>


texts: Magento 2.3.x CE Payment Gateway Interface Redirects to External PSP Window/Endpoint

texts:
I'm a newbie in Magento, currently trying to customise/create new payment gateway interface for a CE version 2.3.x setup.
I've tried referring to the devdocs, used the famous Sample module project as a guide, and also checked multiple forums, but no dice.
Sometimes I got myself confused the more I checked.
I wonder if I'm missing something.

Basically in my case, the gateway's interface is simple, upon placeOrder, that button should POST relevant data to a URL (a payment window by the Payment Service Provider or "PSP"). Consumers will pay using that window, and upon success (or failure), that PSP window will redirect back to a page of our choice, with the success/failure status.

From the sample files, the eventual button will call the placeOrder command. I believe that is for the "Authorise" action.
Doing some research, I understand that the action to use should be "Authorise and Capture" for my case, as opposed to "Authorise" only.

So, from here, where do we customise/overload/override this command so that it can redirect to that desired PSP's payment window?

Thanks in advanced!


texts: Overriding third party extension modules model not working (local on local override)

texts:
I've created a small module

app/code/local/Mycompany/Managa/config.xml

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

<config>

<modules>
    <Mycompany_Managa>
        <version>0.1.0</version>
    </Mycompany_Managa>
</modules>

<global>
    <models>
        <mana_filters>
            <rewrite>
                   <managa>Mycompany_Managa_Filters_Model_Filter_Attribute</managa>
            </rewrite>
        </mana_filters>
    </models>
</global>

</config>

app/code/local/Mycompany/Managa/Filters/Model/Filter/Attribute.php

  class Mycompany_Managa_Filters_Model_Filter_Attribute extends Mana_Filters_Model_Filter_Attribute
{
  //exact copy of Mana_Filters_Model_Filter_Attribute
 }

app/etc/modules/Mycompany_Managa.xml

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

        <active>true</active>

        <codePool>local</codePool>

        <depends>
            <Mana_Filters/>
        </depends>

    </Mycompany_Managa>
</modules>

</config>

The file that I'm trying to override is located at /app/code/local/Mana/Filters/Model/Filter/Attribute.php and as mentioned above it has a class - Mana_Filters_Model_Filter_Attribute.

I assume it's something to do with my config file but no matter what I do I can't seem to get the site to use my version of the model. I've followed other questions with similar questions such as - one,two and three, but I'm obviously doing something wrong.


texts: paypal; unable to change from sandbox test mode to Live Paypal

texts:
I am unable to change from PayPal sandbox setting to Live setting.
I disabled sandbox mode and entered my correct Live Paypal details. I also cleaned my cache.

However, When I try to make a paypal payment on my Live site i still get redirect to paypal  sandbox account.
I change I keep getting redirected


texts: How to create dynamic grouping of products at cart page?

texts: I have a custom module.It consists of products selection and while adding to cart I want to group that selected product.


texts: Where does the /versionXYZ/ directory come from in pub/static?

texts:
I'm developing a theme right now, and some of my image assets are 404'ing because they are trying to load from a strange directory in /pub/static.

When I ls in /pub/static, there is no /versionXYZ/ directory there at all, only .htaccess, _requirejs folder, and frontend folder, as expected.

I've done bin/magento cache:flush and grunt exec and grunt less already, and it still is referencing this weird URL.

Where does that reference come from?


texts: Magento 2: How to Override a third-party module by my theme?

texts:
I know how to override a native Magento 2 module templates such as "magento/module-customer", "magento/module-contact" etc....

But I curious to know, how to override a third party module placed in app/code/Sample_vendor1/Sample_module1 through my theme app/design/frontend/My_vendor/My_theme

Thank You.


texts: Magento 2: Calling Custom File on Root Gives RuntimeException

texts:
I'm calling Magento 2 Outside Magento using below ones

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

My URL abc.com/test.php in 'test.php` it contains code.

It gives below error

Fatal error: Uncaught RuntimeException: The specified "/var/www/html/magento/var/generation/Magento/Customer/Model/CustomerFactory.php.10709" file could not be written Warning!file_put_contents(/var/www/html/magento/var/generation/Magento/Customer/Model/CustomerFactory.php.10709): failed to open stream: Permission denied in /var/www/html/magento/vendor/magento/framework/Code/Generator.php:115 Stack trace: #0 /var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Custome...') #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Custome...') #2 [internal function]: spl_autoload_call('Magento\Custome...') #3 /var/www/html/magento/vendor/magento/framework/ObjectManager/Relations/Runtime.php(38): class_exists('Magento\Custome...') #4 /var/www/html/magento/vendor/magento/framework/Interception/Config/Config.php(153): Magento\Framework\ObjectManager\Relations\Runtime->has('Magento\Custome...') #5 /var/www/html/m in /var/www/html/magento/vendor/magento/framework/Code/Generator.php on line 115

Before this line it works fine

$url = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $url->get('\Magento\Store\Model\StoreManagerInterface');

After this line it gives error.


texts: How to move Magento core queues to RabbitMQ?

texts:
Magento has some core queues like:

catalog_product_removed_queue
codegenerator
export
inventory.mass.update
inventory.reservations.cleanup
inventory.reservations.update
inventory.source.items.cleanup
inventory_qty_counter_queue
product_action_attribute.update
product_action_attribute.website.update

Magento uses MySQL tables for managing asynchronous operations by default. Because these queues defined with connection="db" in queue.xml.
Is there a way to use RabbitMQ for these core queues without editing for Magento's core files like vendor/magento/module-catalog/etc/queue.xml. Can we override connection type of these queues?


texts: how to add one more attribute to select which is a custom attribute in product listing

texts:
I have a custom attribute added to my catalog.its is a select box

While listing catalog i want to show it filtered by that attribute.

In my mage/adminhtml/block/catalog/product/grid.php i have _preparecollection function

I am trying to add my extra filter to _preparecolletion from my custom module.

How to do that

 protected function _prepareCollection()
    {
        $store = $this->_getStore();
        $collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('sku')
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('attribute_set_id')
            ->addAttributeToSelect('type_id')
            ->addFieldToFilter('my_custom_field');// i want to add this filter from my custom module
        // so that i don't need to touch my core files.

is it possible?


texts: Add a custom/programmed block to a CMS page

texts:
I have created a page using the CMS (via Admin Portal) and now I want to add a custom block (programmed) to the page.
You can see the created page here:

My structure is the following:

but unfortunately I do not get the created CMS page with the block connected.
I thought that maybe the Router ID has to be set to cms. But I don't know exactly how to adjust the files accordingly.
Do you have any ideas?


texts: Add attribute to registration form in Magento 2

texts:
I created my custom attribute inside my module.

app/code/Riccardo/Plugin/Setup/InstallData.php

<?php
namespace Riccardo\Plugin\Setup;

use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
    /**
     * Customer setup factory
     *
     * @var \Magento\Customer\Setup\CustomerSetupFactory
     */
    private $customerSetupFactory;
    /**
     * Init
     *
     * @param \Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory
     */
    public function __construct(\Magento\Customer\Setup\CustomerSetupFactory $customerSetupFactory)
    {
        $this->customerSetupFactory = $customerSetupFactory;
    }
    /**
     * Installs DB schema for a module
     *
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     * @return void
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

        $installer = $setup;
        $installer->startSetup();

        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
        $entityTypeId = $customerSetup->getEntityTypeId(\Magento\Customer\Model\Customer::ENTITY);
        $customerSetup->removeAttribute(\Magento\Customer\Model\Customer::ENTITY, "promotion_code");

        $customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, "promotion_code",  array(
            "type"     => "varchar",
            "backend"  => "",
            "label"    => "Promotion Code",
            "input"    => "text",
            "source"   => "",
            "visible"  => true,
            "required" => true,
            "default" => "",
            "frontend" => "",
            "unique"     => false,
            "note"       => ""

        ));

        $promotion_code   = $customerSetup->getAttribute(\Magento\Customer\Model\Customer::ENTITY, "promotion_code");

        $promotion_code = $customerSetup->getEavConfig()->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'promotion_code');
        $used_in_forms[]="adminhtml_customer";
        $used_in_forms[]="checkout_register";
        $used_in_forms[]="customer_account_create";
        $used_in_forms[]="customer_account_edit";
        $used_in_forms[]="adminhtml_checkout";
        $promotion_code->setData("used_in_forms", $used_in_forms)
            ->setData("is_used_for_customer_segment", true)
            ->setData("is_system", 1)
            ->setData("is_user_defined", 0)
            ->setData("is_visible", 1)
            ->setData("sort_order", 100);

        $promotion_code->save();

        $installer->endSetup();
    }
}

This create a required attribute "Promotion Code", but only on Admin Panel.
(ScreenShot)

How can I add this attribute to frontend registration form in Magento 2?


texts: How to query database models in magento 2.4

texts:
I gather how to create the database via an XML via https://devdocs.magento.com/guides/v2.4/extension-dev-guide/declarative-schema/db-schema.html
and using bin/magento setup:db-declaration:generate-whitelist module_name to generate the whitelist and  bin/magento setup:upgrade to install the changes.
What I can't find is how to get data from the database in magento 2.4.
I found https://magento.stackexchange.com/a/303748/662 and https://www.mageplaza.com/magento-2-module-development/how-to-create-crud-model-magento-2.html which details how to set up a method that loads database items automatically when fetched via a page, but that is useless when you need certain models fetched without automatic insertion.
But how about direct queries that return models. Does magento 2 have a method like laravel's eloquent to do queries to fetch database model instantiated objects directly when needed via a query, or is this crude method the only way to fetch data? https://www.rakeshjesadiya.com/direct-sql-queries-in-magento-2/


texts: magento 2.2.8 Configurable product: Changing color showing second gallery image as selected

texts:
I am using Magento 2.2.8 and facing a weird issue on Product Detail Page.

On the Product Details Page, my gallery shows the wrong image as selected, instead of the first one.

Steps:

  Land on Product Details Page.
  Click on second image in the Product gallery.
  Change the Product color
  Image gallery refresh itself and instead of first image which is the
  main image, it show the second image as selected.

I am using Porto theme, verified it on Luma as well and getting the same issue on it.

I am trying to find and fix the cause, if someone directs me on

the right direction.

Thanks


texts: Checking if a static block is enabled/disabled on a multi-store site

texts:
I've recently found two methods for checking if a static block is enabled on a multi-store site:

getIsActive() method

<?php
    $storeId = Mage::app()->getStore()->getStoreId();
    $block = Mage::getModel('cms/block')->setStoreId($storeId)->load('footer_promo_as_seen');
    $blockIsActive = $block->getIsActive();
?>

<?php if($blockIsActive): ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_promo_as_seen')->toHtml(); ?>
<?php endif; ?>

!empty method

<?php $asSeenHtml = $this->getLayout()->createBlock('cms/block')->setBlockId('footer_promo_as_seen')->toHtml(); ?>

<?php if (!empty($asSeenHtml)): ?>
        <?php echo $asSeenHtml; ?>
<?php endif; ?>

My question is, which one negatively affects performance the most?. I suspect the getIsActive()?


texts:
I want to add custom product attribute to sales order grid, and here is my code below,

$collection = Mage::getResourceModel($this->_getCollectionClass())
$vendor1_total = Mage::getResourceModel('catalog/product')->getAttribute('vendor1_total');
 $collection->getSelect()
            ->join(array('ce1' => 'catalog_product_entity_varchar'), 'ce1.entity_id=main_table.product_id', array('vendor1_total' => 'value'))
            ->where('ce1.attribute_id=' . $vendor1_total->getAttributeId())

            ->columns(new Zend_Db_Expr("CONCAT(`ce1`.`value`"));

and Im getting Unknown column error, and query is,

SELECT COUNT(*) FROM `sales_flat_order_grid` AS `main_table`
 INNER JOIN `sales_flat_order_address` AS `soas` ON soas.parent_id=main_table.entity_id and soas.address_type = "shipping"
 INNER JOIN `sales_flat_order_item` AS `sales/order_item` ON `sales/order_item`.order_id=`main_table`.entity_id
 INNER JOIN `catalog_product_entity_varchar` AS `ce1` ON ce1.entity_id=sales_flat_order_item.product_id
 LEFT JOIN `sales_flat_order` AS `order` ON order.entity_id=main_table.entity_id

Of course the error is correct, there is no column name of product_id in sales_flat_order_grid . But I tried to replace the table name - main_table with sales_flat_order_item where the column is exist. But still its taking old table main_table - sales_flat_order_grid. So I want to changes this main_table to sales_flat_order_item (If it will not affect other parts) or how to use this table sales_flat_order_item to fetch my column into grid. Please help me.


texts:
For some reason this runs every day at a random time (MySQL cron_schedule update). Its causing our system to slow down or even become unresponsive for a few minutes.

Does anyone know what is this doing? Today it ran for 1960 second

  Slow query trace 1:05 PM 7,200,000ms MAX TIME  ACTION Query
  UPDATE cron_schedule SET status = ? WHERE (schedule_id = ?) AND
  (status = ?)  Stack trace …nt::execute called at
  /home/removeduserd/public_html/lib/Zend/Db/Statement/ Pdo.php (0) …ute
  called at /home/removeduserd/public_html/lib/Varien/Db/Statement/Pdo/
  Mysql.php (110) …Mysql::_execute called at
  /home/removeduserd/public_html/lib/Zend/Db/ Statement.php (320)
  …:execute called at
  /home/removeduserd/public_html/lib/Zend/Db/Adapter/ Abstract.php (479)
  …uery called at
  /home/removeduserd/public_html/lib/Zend/Db/Adapter/Pdo/ Abstract.php
  (238) …query called at
  /home/removeduserd/public_html/lib/Varien/Db/Adapter/Pdo/ Mysql.php
  (419) …l::query called at
  /home/removeduserd/public_html/lib/Zend/Db/Adapter/ Abstract.php (632)
  …/home/removeduserd/public_html/app/code/core/Mage/Cron/Model/Resource/
  Schedule.php (63) …alled at
  /home/removeduserd/public_html/app/code/core/Mage/Cron/Model/
  Schedule.php (217)
  …/home/removeduserd/public_html/app/code/community/Aoe/Scheduler/Model/
  Observer.php (64) …tch called at
  /home/removeduserd/public_html/app/code/core/Mage/Core/Model/ App.php
  (1338) …hod called at
  /home/removeduserd/public_html/app/code/core/Mage/Core/Model/ App.php
  (1317) …ore_Model_App::dispatchEvent called at
  /home/removeduserd/public_html/app/ Mage.php (447) in
  Mage::dispatchEvent called at /home/removeduserd/public_html/cron.php
  (46)


texts: Magento 2 theme not loading my css files

texts:
I am new to Magento theme development. I have gone through the frontend development guide and set up my child theme of the Magento Blank theme. I have done all that the guide says and added my css file but it is not showing on the frontend. Below is my setup. Any help would be great!

design/frontend/DouglasMedia/henryhiggs

Inside the folder henryhiggs it is:

|-etc
|  |-view.xml
|
|- Magnto_theme
|  |-layout
|      |-default_head_blocks.xml
|      |-default.xml
|
|-media
|   |-preview.jpg
|
|-web
|   |-css
|      |-custom.css
|   |-fonts
|   |-images
|   |-js
|
|-registration.php
|-theme.xml

Here is the code for default default_head_blocks.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>

    <css src="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" src_type="url"/>

    <css src="//fonts.googleapis.com/css?family=Montserrat:400,700" src_type="url"/>
    <css src="//fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900" src_type="url"/>
    <css src="css/custom.css" />

    <script src="jquery.js" />
    <script src="bootstrap/js/bootstrap.min.js" />
</head>

Here is the code for the theme.xml file

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>Henry Higgs Theme</title> <!-- your theme's name -->
 <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
 <media>
     <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
 </media>
 </theme>

Let me know if I need to give any more code for any of the other files.

I have tried to run the following commands and then cleared the cache and so joy.

php bin/magento setup:upgrade --keep-generated
php bin/magento setup:static-content:deploy

Please let me know if I am missing anything.

Only other thing it might be is that there is no files under design/frontend/Magento/blank. I looked at another forum and they said it was ok as it is stored elsewhere. It seems to be the case as the "blank" theme is showing when I have my custom theme activated. Only cannot see any custom css I add.

Thanks in advance :D


texts:
How can I check if a product is new in Magento 2?

I found this solution for Magento 1:

function isProductNew(Mage_Catalog_Model_Product $product)
{
    $newsFromDate = $product->getNewsFromDate();
    $newsToDate   = $product->getNewsToDate();
    if (!$newsFromDate && !$newsToDate) {
        return false;
    }
    return Mage::app()->getLocale()
            ->isStoreDateInInterval($product->getStoreId(), $newsFromDate, $newsToDate);
}

How can I migrate this code to make it work in Magento 2 ?


texts: Requested store is not found in magento 2 website loading

texts:
I have my Magento 2 website.
If I type the URL like https://emerald.lk it's working fine.
If I add the www to the URL website is not loading and giving the following error.

There has been an error processing your request.
Requested store is not found

Error file is like below.

{"0":"Requested store is not found","1":"
#0 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-store/Model/StoreManager.php(168): Magento\Store\Model\StoreRepository->get('')\n
#1 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/generated/code/Magento/Store/Model/StoreManagerInterface/Proxy.php(119): Magento\Store\Model\StoreManager->getStore('')\n
#2 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-store/Model/Resolver/Store.php(29): Magento\Store\Model\StoreManagerInterface\Proxy->getStore(NULL)\n
#3 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/App/Config/ScopeCodeResolver.php(49): Magento\Store\Model\Resolver\Store->getScope(NULL)\n
#4 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/App/Config.php(69): Magento\Framework\App\Config\ScopeCodeResolver->resolve('stores', NULL)\n
#5 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-store/Model/BaseUrlChecker.php(65): Magento\Framework\App\Config->getValue('web/unsecure/ba...', 'stores')\n
#6 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(123): Magento\Store\Model\BaseUrlChecker->isFrontendSecure()\n
#7 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(69): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->isHttpsRedirect(Object(Magento\Framework\App\Request\Http))\n
#8 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n
#9 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n
#10 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n
#11 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n
#12 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)\n
#13 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n
#14 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()\n
#15 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()\n
#16 /chroot/home/aee9c6e2/muj2d0443a.mlity.net/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#17 {main}","url":"/?SID=76c2d9c36a89185a0418f804b6810a79","script_name":"/index.php"}

I set the Use SID on Storefront to No. and run the indexing too. Can some one please help me to fix this issue.


texts: what is resultPageFactory in magento 2 and what is the use of it ?


texts: Magento 2 : Uncollapse Summery On First Step Of Checkout Page

texts:
I need to uncollapse summery block on first step of checkout page.

Currently On first step (address) it's collapsed, then on next step it's uncollapsed.

I would like it to be also uncollapsed on first step of checkout page.

Thanks everyone in advance!


texts: How to add loader untill the image not ready on page load

texts:
I want to show the image in particular div.

I want to show the empty div . if the img src is ready , then it display the img tag in particular div

How to do that?

Thanks.


texts:
I want to use node_modules js in Magento2 but there is a require js conflict error.
How can I solved and use node_modules in magento2?

EDIT:

requirejs-config.js code:

var config = {
    map: {
        '*': {
            lightwallet:'Unitedcrowd_Tokensale/js/lightwallet'
        }
    }
};

// This light wallet is using node_modules packages and due to that mismatch error has appeared.


texts: Overriding parent templates by a child theme in same vendor directory

texts:
I want to override
app/design/frontend/vendor/maintheme/Magento_Catalog/templates/product/price/final_price.phtml

in
/app/design/frontend/vendor/child-of-maintheme/

I made same path
/app/design/frontend/vendor/child-of-maintheme/Magento_Catalog/templates/product/price/final_price.phtml

but still reads from main theme. What is missing here?


texts: Unable to import customers from Magento 1.3.1 to Magento 1.9.1. - I get an Error

texts:
I tried to EXPORT THE CUSTOMERS from Magento 1.3.1 - I get the csv file but when I try to import it into my new Magento 1.9.1 installation - it gives the following Error:

    **Can not find required columns: _website
    Please fix errors and re-upload file**

What do I need to do to fix this? Thanks to anyone for suggestions! ;-)


texts: Magento 2 - Category Save Event is not called when save category via rest api

texts:
I have created one observer CategorySaveAfter.php file in my custom module.

And calling this observer on catalog_category_save_after event define in events.xml

But somehow its not calling when i save category using restApi

Its working fine when i save category from magento2 backend it calling observer staightforward.

But for Rest APi its not working .

Below code i have tried :

Vendor/Module/etc/adminhtml/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_category_save_after">
        <observer name="catalog_megamenu" instance="Vendor\ModuleName\Observer\CategorySaveAfter" />
    </event>
</config>

Vendor/Module/Observer/Categorysaveafter.php

<?php
/**
 * Copyright Â© 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor\ModuleName\Observer;

use Magento\Catalog\Model\Category;
use Magento\Framework\Event\ObserverInterface;

class Categorysaveafter implements ObserverInterface
{
    protected $test;

    public function __construct(\Vendor\Modulename\Model\ModelFactory $testMenu)
    {
        $this->test = $testMenu;
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        echo "goes here";exit;
    }
}

Yes i have added registration.php and module.xml file as well.

Update :

Forgot to mention that i have tried global level events.xml as well . Like etc/events.xml and etc/webapi_rest/events.xml . Still both way its not calling

Your help will be appreciated.


texts: How to call static block into graphql query in alpine js framework

texts:
enter code

 response.json())
                    .then(data =>cmsBlock = data.cmsBlock)
        "
    >

[![enter image description here][1]][1]


texts:
I would like to get customer details from all orders, specifically email address and company name if it exists. When I export customers via the Magento export menu, I only get a limited list of registered customers. We have many customers who don't register, and I want to have them in the list as well.

It's OK to do this via MySQL. Export to CSV is even better.


texts:
I can't Install Magento 2.2.6 via composer on macOS High Sierra + I'm use MAMP Pro and getting some problems :

    Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for magento/product-community-edition 2.2.6 -> satisfiable by magento/product-community-edition[2.2.6].
    - magento/product-community-edition 2.2.6 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

This is extensions from  php.ini :

    ; Extensions

MAMP_apc_MAMPextension=apcu.so
MAMP_apc_MAMPextension=apc.so
extension=imap.so
extension=gettext.so
extension=mcrypt.so
extension=pgsql.so
extension=pdo_pgsql.so

MAMP_Imagick_MAMPextension=imagick.so
MAMP_Tidy_MAMPextension=tidy.so
MAMP_Oauth_MAMPextension=oauth.so
MAMP_Igbinary_MAMPextension=igbinary.so
MAMP_Memcached_MAMPextension=memcached.so
MAMP_Redis_MAMPextension=redis.so
;extension=uploadprogress.so
;extension=yaml.so

Also I'm using next commands :

php -m | grep mcrypt
mcrypt

My php version - 7.0.31
Apache - Apache/2.4.33 (Unix)


texts:
I'm setting up a Magento site and am so far we're only using the default attribute set which has several configurable attributes.

size
hat size
table cloth size

Size and hat size relate to products which fall into our clothing category while table cloth size is for products which fall into our linen category.

We have several other examples like this and I'm wondering if I should create different attribute sets for clothing and linen?  What would be the advantage of doing this?  It seems simpler to just use the default attribute set for all or am I missing the benefit of splitting them by attribute set.  I'm thinking of creating an attribute for product type, e.g. cloths and linen.


texts:
I want to sort a catalog_product_collection by multiple attributes but with special input.

As I understand the method addAttributeToSort calling it like this

addAttributeToSort("attribute");

Seems to do the trick, if it can load the attribute. But I need to call it like that:

addAttributeToSort("attribute IN ('001')");

Which will fail because it cannot load an attribute called attribute IN ('001')

How would I sort the collection in this case?

Reason: We want the product collection order in a special format. I have the algorithm done and its working fine (pagionation is broken now, but thats another topic) but a co worker showed me that you could so an ORDER BY like that:

ORDER BY x.Component_Stone_Color IN ('001') DESC, x.Component_Stone_Color IN ('280') DESC, ....

Edit

Something like this seems to work:

$sql = $collection->getSelect();
 $sql->order(array("sw_stone_color IN ('001') DESC", "sw_stone_color IN ('280') DESC", "sw_...", ...));

But the needed attributes are not (yet?) selected.
An $collection->addAttributeToSelect(array('sw_stone_color', 'sw_effects', 'sw_foiling', 'sw_motifs')); doesnt seem to do the trick, sadly. (They are simply not selected when I look at the output query)

I'm in the catalog_product_collection_load_before event.


texts:
I want to make a simple list or table of products, belonging to a set category.

Currently, this kind of works if I use:

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

However, I want a bare-bones list of names, that hyperlink to the product pages (no images, icons, etc)

What would be a solution here? Create a custom list.phtml page, edit the code to output a simple list, and reference that instead? Is that 'legal' - code/system wise?

Any ideas would be appreciated.


texts:
Can anyone give me the solution on the following error i.e.

report.CRITICAL: Could not receive Stock Item data {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): Could not receive Stock Item data at \\vendor\\magento\\module-inventory-indexer\\Model\\ResourceModel\\GetStockItemData.php:68, Zend_Db_Statement_Exception(code: 0): SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('user_8rwzz4kd1lr'@'%') does not exist, query was: SELECT `inventory_stock_1`.`quantity`, `inventory_stock_1`.`is_salable` FROM `inventory_stock_1` WHERE (sku = 'abc')

Why I am getting this error in the first place and why Magento is trying to fetch the data from a table which does not exist in my DB. Thanks in advance.


texts:
i have merged my magento CSS and JS via the admin backend,after that i was remove the CSS and JS merge option.

After when i look the view source it like be one single line.
see the image below for your better understanding.

How to overcome with this,help me to rectify my problem.


texts: Custom category designs won't apply without category url slug?

texts:
I'm experiencing a weird issue: Let's say category A has a custom design. When I open the product via domain.com/category-a/product.html the custom design applies correctly.

But when I open the product through Magento's canonical/Google sitemap url domain.com/product.html the custom design won't apply.

How can I bypass that behaviour? I suppose that's because Magento doesn't know which category's custom design to apply as a product can have more than one category?

Layout structure is:

custom design
-> default
-> category_custom


texts: Magento 2 Product Image not showing in backend and can't upload image

texts:
1) When Edit or add new product in admin (backend) the product image doesn't show up

2) When choosing an image to upload, nothing happens

3) I have checked Magento_ProductVideo::helper/gallery.phtml where data-mage-init='{"openVideoModal":{}}' not loading JS component of openVideoModal = Magento_ProductVideo/js/video-modal.js.

If anyone knows how to solve this please help me.


texts:
I want to show "Creation date" of an order in:

Sales -> Orders -> User -> Information -> Payment methods

At the moment I'm using this code:

class Company_Module_Block_Info extends Mage_Payment_Block_Info
{
    protected function _prepareSpecificInformation($transport = null)
    {
        if (null !== $this->_paymentSpecificInformation) {
            return $this->_paymentSpecificInformation;
        }

        $info = $this->getInfo();
        //Zend_Debug::dump($info); //List with created_at date

        $transport = new Varien_Object();
        $transport = parent::_prepareSpecificInformation($transport);
        $transport->addData(array(
            Mage::helper('payment')->__('Expiration date') => $info->getExpireDate(),
            Mage::helper('sales')->__('Creation date') => $info->getCreatedAt(),
            Mage::helper('payment')->__('Picked up by') => $info->getPickupCustomer()
        ));

        return $transport;
    }
}

The line which isn't working is this one:

Mage::helper('sales')->__('Creation date') => $info->getCreatedAt(),

At the moment it gives NULL, but I expect to return the custom creation date of the order (in format yyyy-mm-dd hh:mm:ss). When I use Mage::getModel('sales/order')->getCollection()->getFirstItem(); $order->getCreatedAt(); It returns the first created at date of the first order, but I need it for the selected order.

Does someone have any idea what is wrong?


texts: Magento 2 : How to move image to desired folder?

texts:
I've image name and i would like to save it to my desired folder.

How to achieve this ? Any help would be appreciated.

Update

I am trying to implementing Image Crop function at frontend.

Like User will get option to get crop image option while they upload image.

For that I'm using a example. Check Here

Its working for Core PHP.

I am trying to implementing this code in my controller.

    $data = $this->request->getParam('group_image');

    list($type, $data) = explode(';', $data);
    list(, $data)      = explode(',', $data);

    $data = base64_decode($data);
    echo $imageName = time().'.png'; exit;

Here $imageName returns Image Name now i want to save this image under Pub/Media.

PS : PHP they have used file_put_contents('upload/'.$imageName, $data);

IF i use file_put_contents its working but due to i am doing this in Module MEQP2 standard not allow me to use this function I've to implement this in Magento way.

Question :  What is Best Magento way to achieve this ?


texts:
Is there any way where a magento website is enabled and opens even if teh internal IT firewall blocks it.

Also no one blocked my website in the office. Still i am not able to open it in the office network, whereas many other websites are opening. Any solution?


texts: Is there a way to print shipping forms from Magento?

texts:
I need to be able to print shipping forms from Magento.  Specifically the USPS Customs and Express Address Labels which I have to use most often.  Is there anything that will allow me to do that?

NOTE: I am fully aware of the possibility of using an API to submit everything electronically, however, there are places where I ship to that using it is not possible.


texts: Magento incl. and excl. TAX not showing correctly for GUESTS

texts:
I have configured magento 1.9.x CE to display catalog prices including and excluding VAT (TAX) at 20% which is working fine for logged in users under the "General" customer group. Both Incl and Excl TAX prices are calculated correctly for these logged in users.

However for guest users no TAX is being calculated, both prices incl and excl TAX are showing identical values.

All settings are configured correctly and the "NONE Logged in users" (guests) are set to use the same tax configuration as "logged in" (normal) customers.

Any thoughts on why VAT (TAX) is not being calculated for "Not logged in" (Guest) customers ?

Thanks


texts: The stock item was unable to be saved. Please try again. Magento 2.4.0

texts: I installed magento 2.4.0 on my Linux server from godaddy. I'm unable to add the products to it. It is showing the Error is The stock item was unable to be saved. Please try again. Can any one help me from this please


texts:
i would like to change the layout of the magento shopping cart to the same layout as the Onepage-Checkout.

Does anyone have a quick idea how to do this?


texts: How to remove create an order button in sales order grid in magento2

texts:
i m overriding above code in di.xml file in magento2

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="sales_order_grid_data_source" xsi:type="string">Knight\Noecom\Model\ResourceModel\Order\Grid\Collection</item>
        </argument>
    </arguments>
</type>


texts:
What should  i follow ui_component form or php form  so my module can work on all magento 2 versions. Or Should i create two  modules so they will work on magento 2.0 and magento 2.1?
Any one else have a better solution for that?


texts: Special order items for our phone orders

texts:
From time to time we get phone orders for custom items that we need to special order. The issue is that we want to be able to use a custom item in magento and input the description and price on the spot when the order is created.

It's too much trouble to create a new item while the customer is on the phone.

How do I do this in Magento 1.9.0.1


texts: How to get Quantity Order for product to display on Product Page

texts:
Trying to get this to work, it is not return anything :(

 $product = Mage::getResourceModel('reports/product_collection')
 ->addOrderedQty()
 ->addAttributeToFilter('sku', $_product->getSku());
 echo 'Already Bought '.(int)$product->ordered_qty; ?>


texts: Magento 2: Get product by custom attribute

texts:
I need to get a product but I only have a custom attribute (EAN), no ID, no SKU.

Is there a way to get a product by custom attribute in M2? The error I get when trying is this:

Fatal error: Uncaught TypeError: Argument 1 passed to
Magento\Catalog\Model\ResourceModel\Product\Collection::getEntityPkName()
must be an instance of Magento\Eav\Model\Entity\AbstractEntity,
instance of Magento\Catalog\Model\ResourceModel\Product\Flat given,
called in
vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php
on line 1369

and defined in /home/www/olesiejuk/www/dev.olesiejuk.pl/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php on line 1532

Thank you!

UPDATE (add code):

//[step] get product ID
    $filter = $this->filterFactory->create();

    $filter
        ->setField('ean')
        ->setValue($value)
        ->setConditionType('eq');

    $this->searchCriteriaBuilder->addFilter($filter);

    $productCriteria = $this->searchCriteriaBuilder->create();

    $product = $this->product->loadByAttribute('ean', $value);

    $products = $this->productRepository->getList($productCriteria)->getItems();


texts: Seperate Store for Desktop and Handheld Devices

texts:
I need to create separate website for handheld devices and desktop. For that I created a module to make an observer for the event of controller_action_predispatch. My config.xml observer snippet is as follows.

<global>
  <events>
    <controller_action_predispatch>
       <observers>
         <Company_Module_Model_Observer>
            <type>singleton</type>
            <class>Company_Module_Model_Observer</class>
            <method>switchStore</method>
         </Company_Module_Model_Observer>
       </observers>
     </controller_action_predispatch>
   </events>
 </global>

In Observer.php I've written script to check device type and based on result I set the store. Code snippet is as follows

if($handheldDevice) {
Mage::app()->setCurrentStore('mobile_view'); //It's my store view code
}

It's switching store fine. I can set different home page for each store and categories too. All cms pages, cart page also seem good. But when I click a category, I'm getting oops error page. Why is it so? (Category is active in admin).

Can anyone help here?


texts: Magento 2.1.3 Build multiple store views with unique subdomains pull CSS and JS from parent website URL?

texts:
I've been googling this all afternoon, suffering from Search Engine blindness, so much so I even tried bing for a moment...

I have a multiple language site set up with different URL's assigned to different store views, here's an example :

All Store View : primary.domain.tld
--> Store One : [en] one.domain.tld
   --> View One : [en] one.domain.tld (inherit from default)
   --> View Two : [fr] two.domain.tld
--> Another Store : [de] another.domain.tld

This is the clients requirement not mine so refactoring domains or creating new ones for websites/stores is out I'm afraid.

Now the site works fine but when I view two.domain.tld all the CSS and JS is requested from one.domain.tld. It all works but the fonts that get called trigger alot of CORS messages and some of the JS complains about cross origin.

The stricter developer in me also considers if i end up overriding a CSS or JS file for some reason for that specific store view that will bawk too.

Ideally I'd like the CSS, JS and all requests to be coming from two.domain.tld (the assets being requested are in the correct pub/static folder too).

For the two.domain.tld Store configuration all the Base URL's parameters in "web" section, for both Secure and Unsecure are overriden and set tot he correct domain (Base URL, Base Link URL, Base URL for Static View Files & Base URL for User Media Files).

Anyone got any ideas? Obvs all these CSS and JS files are referenced in the theme layout (or module layout), as said above they are deployed to the correct pub/static folders but the


texts: Magento 2: How virtual product hide shipping step?

texts:
I want to know how shipping step is skipped on checkout page for virtual product. I know virtual product skips shipping step on checkout page but how it it works internally.

Acually I want to apply same functionality for bundle product but firstly I want to know real working of skipping shipping step for virtual product.


texts: validation errors than can cause problems

texts:
vendor/temando/module-shipping-m2/Observer/PickupEmailObserver.php

What happen if $transport is null ?
see line 93

$order = $transport->getData('order');

  /magento/module-sales/Model/OrderRepository.php

What happen if $order->getPayment() return null ?
see line

$paymentAdditionalInformation = $order->getPayment()->getAdditionalInformation();


texts: CMS Pages and static blocks not editable

texts:
I am not sure, but I guess this problem appeared after installing the latest Magento 1.9.1.0.
When I want to edit a CMS page or a static block in the admin interface, the area that should display the content fields does not disappear. The list on the left appears on the CMS page, but not the right column. At static blocks the complete page does not render content.

Neither the server log nor the Magento logs list any errors. The rendering just appears to stop as soon as the content fields should be loaded. I suspect the closing tags are just created by the Google Chrome browser, otherwise there would be nothing afterwards. Also the footer is not visible.

,

Edit: In the log file there are some errors after enabling it in the index.php file:
2016-03-15 14:05:22 Error   MYIP    500 GET /index.php/admin/cms_page/edit/page_id/12/key/e152a21cf52d77869a262babf00d1772/ HTTP/1.1    https://DOMAIN/index.php/admin/cms_page/index/key/3637ecbed73f7eafed680263120a95c0/ Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36   60.1 K  Apache-SSL-Zugriff

2016-03-15 14:05:22 Warning MYIP        mod_fcgid: stderr: PHP Fatal error: Class 'Varien_Data_Collection_Filesystem' not found in /PATHTOPAGEROOT/app/code/core/Mage/Widget/Model/Widget/Config.php on line 85, referer: https://DOMAIN/index.php/admin/cms_page/index/key/3637ecbed73f7eafed680263120a95c0/               Apache-Fehler

2016-03-15 14:05:25 Error   62.138.0.25 404 GET /robots.txt HTTP/1.1        Mozilla/5.0 (compatible; seoscanners.net/1; +spider@seoscanners.net)    21.3 K  Apache-SSL-Zugriff

Edit2: Thinking about it I have done a malware scan recently and I know that said malware scan adds a .suspected extension to files which could lead to an error, as the file cannot be found. But I am not sure which file to look for.


texts:
I have magento version 1.9.2.3 installed and the new order e-mail is delivered late for some unexpected reason. It takes 8-10 min to receive the order e-mail.

I've searched on forum but found nothing.

Anyone has the same issue?


texts:
I have a magento store that also has a link labeled 'shop local' that a customer can click to get information on our one retail location.

As we only have one store in one state, I would like to somehow only show that link if a customers IP is from the appropriate state.   I would prefer a way with CSS, but realize this probably requires js.  Thanks in advance.

Pleas note: our ecommerce store is open to all of the US.  So the reason to hide the link for other 49 states is to reduce confusion.


texts: Magento 2 How to create options array for use in backend grid

texts:
all. Fairly new in Magento development. I am trying to get a dropdown select element in UI grid with values read from database working.

Currently I have it working in a non-preferred manner with the use of ObjectManager, but I gather it's not the 'proper' way.

What I currently use is:

<?php
namespace WDT\Faq\Model\Category\Source;

class Status implements \Magento\Framework\Data\OptionSourceInterface
{
    //*
    // @var \WDT\Faq\Model\Category
    //
    protected $_category;

    //*
    // Constructor
    //
    // @param \WDT\Faq\Model\Category $category
    //
    public function __construct(
        \WDT\Faq\Model\Category $category
    )
    {
        $this->_category = $category;
    }

    /**
    * Get options
    *
    * @return array
    */
    public function toOptionArray()
    {
        $options[] = ['label' => '', 'value' => ''];
        //
        //  Q-n-D solution
        //
        $objectManager =   \Magento\Framework\App\ObjectManager::getInstance();
        $connection = $objectManager->get('Magento\Framework\App\ResourceConnection')->getConnection('\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION');
        $result1 = $connection->fetchAll("SELECT * FROM wdt_faq_category");

        foreach ($result1 as $n => $row) {
            $options[] = [
                'label' => $row['name'] . ' ' . __('Category'),
                'value' => $row['category_id'],
            ];
        }
        return $options;
    }
}

So after many tries with extending ResourceModel and/or Block instances I'am stumped. What is the right way to implement this, and get the intended result?


texts: Magento 2 - nearly empty registry when trying to get current category in top menu

texts:
I want to get the current shown category in \Magento\Theme\Block\Html\Topmenu.

When using the anti-pattern Objectmanager approach in phtml via:

$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
$registry = $objectManager->get('\Magento\Framework\Registry');

Or using some dependency-injection via:

class Topmenu extends \Magento\Theme\Block\Html\Topmenu {
    protected $_registry;

    public function __construct(
        Template\Context $context,
        NodeFactory $nodeFactory,
        TreeFactory $treeFactory,
        array $data = [],
        \Magento\Framework\Registry $registry
    ) {
        $this->_registry = $registry;
        parent::__construct($context, $nodeFactory, $treeFactory, $data);
      }

    public function _prepareLayout(){
        return parent::_prepareLayout();
    }

    public function getRegistry() {
        return $this->_registry;
    }

    public function getCurrentCategory() {
       return $this->_registry->registry('current_category');
    }
}

I alway get a nearly empty Registry-Model like:

object(Magento\Framework\Registry)#128 (1) { ["_registry":"Magento\Framework\Registry":private]=> array(1) { ["use_page_cache_plugin"]=> bool(true) } }

What am I doing wrong that when I call "getCurrentCategory()" it is NULL?

Further thoughts:
Is there a place where I have to do a kind of _initCategories()?
Is the registry somehow restricted or private?


texts:
I want to use Magento 2.4.1 in a shared server, the problem is that the shared server is not support Elasticsearch. Is there any way to can remove the Elasticsearch or to disable the entire search functionality?
Thank you


texts: Best practice/scalable way to mass update tier prices?

texts:
In a Magento CE 1.9 shop, I need to update the prices & tier prices for a few thousand products daily.

The product prices I can update easily using the following helper function

Mage::getSingleton('catalog/product_action')
    ->updateAttributes(array($productId), array('price' => $price), 0);

To update the tier prices I unfortunately have to rely on the following which probably isn't very scalable as the whole product is saved every time:

$tierPrices = array();
$tierPrices[] = array(
    'website_id' => 0,
    'cust_group' => 32000, // "All Groups"
    'price_qty' => $qty,
    'price' => $price
);

$product->setTierPrice($tierPrices)->save();

Is there a better way to update the tier prices?