texts:
I upgraded my Cloud hosting account (doubled the processor and memory)  but then was getting a problem with the Session Cookie Management (after customers would log in - it would take them to a page which says: You have no items in your shopping cart. I figured out this is a Session Cookie problem (the end users computer time runs ahead of server’s time, cookies will not get set for Magento frontend as well as backend. For example, end user’s computer time is 1 hour forward than server’s time, that means the cookie (holding user’s session id) will expire as soon as user logs in or tries to add an item).

I contacted the hosting company to correct the server time and they replied:

  Could you please let us know where is the application taking the time
  from? Since all applications can be set to use a specific time, we
  would like to be sure that changing the server time will affect the
  application as well.

in my Magento backend - I have Mountain Standard Time set in:

System - Configuration - General - General - Locale Options

The hosting now says this:

We will gladly change the server time zone for you, but please note that this is a server wide change, that will affect all accounts on the server, and also that we do not know which time zone your Magento installation should use.

Please let us know which time zone should we set, and we will proceed with the change.

Any ideas?


texts: Add to cart before Magento 1 - Cancel adding

texts:
I am creating an observer to cancel the addition to the cart with add_to_cart_before.

  Here is my config.xml

            Module_Stockespagne_Model

     <controller_action_predispatch>
        <observers>
           <controller_action_before>
              <class>dispatcher/observer</class>
              <method>hookToControllerActionPreDispatch</method>
           </controller_action_before>
        </observers>
     </controller_action_predispatch>

     <controller_action_postdispatch>
        <observers>
           <controller_action_after>
              <class>dispatcher/observer</class>
              <method>hookToControllerActionPostDispatch</method>
           </controller_action_after>
        </observers>
     </controller_action_postdispatch>

     <add_to_cart_before>
        <observers>
           <add_to_cart_before>
              <class>dispatcher/observer</class>
              <method>hookToAddToCartBefore</method>
           </add_to_cart_before>
        </observers>
     </add_to_cart_before>

     <add_to_cart_after>
        <observers>
           <add_to_cart_after>
              <class>dispatcher/observer</class>
              <method>hookToAddToCartAfter</method>
           </add_to_cart_after>
        </observers>
     </add_to_cart_after>

  </events>

Here is my Observer.php

class Module_Stockespagne_Model_Observer {

public function hookToControllerActionPreDispatch($observer)
{
    if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')
    {
        Mage::dispatchEvent("add_to_cart_before", array('request' => $observer->getControllerAction()->getRequest()));
    }
}

public function hookToControllerActionPostDispatch($observer)
{
    if($observer->getEvent()->getControllerAction()->getFullActionName() == 'checkout_cart_add')
    {
        Mage::dispatchEvent("add_to_cart_after", array('request' => $observer->getControllerAction()->getRequest()));
    }
}

public function hookToAddToCartBefore($observer)
{
    $request = $observer->getEvent()->getRequest()->getParams();
    $product = Mage::getModel('catalog/product')->load($request['product']);

    if($product->getSku != "TEST"){
        //Display message erroer
    }
}

}

I check some conditions and if they are not validated I want to cancel the addition to the cart and I display an error message.

Thank you!


texts: BASE64_LENGTH_79_INF: SpamAssasin penalizes transactional emails

texts:
I noticed that transactional emails from a Magento shop were often marked as spam. Apache SpamAssasin gives a 2.0 score from the BASE64_LENGTH_79_INF  rule.

The rule explanation states:

  According to http://en.wikipedia.org/wiki/Base64 , base 64 should only be 76 chars long, so these are out of format.

From the linked Wikipedia article:

  MIME does not specify a fixed length for Base64-encoded lines, but it does specify a maximum line length of 76 characters. Additionally it specifies that any extra-alphabetic characters must be ignored by a compliant decoder, although most implementations use a CR/LF newline pair to delimit encoded lines.

So it looks like base64 encoded content is not broken into lines as expected. Did anybody encounter the same? What could cause this bad format?


texts:
I got a following error. When I go to Product editor i cant see the text field. How can I fix it.

http://prntscr.com/n0ca4d

http://prntscr.com/n0cafh


texts: Magento Connect extension installation error log

texts:
I installed Algolia search on a staging version of my website and it worked wonderfully (after a bit of tweaking).  I've just tried to apply that to my production install, starting by installing the extension.

Unfortunately, when I do it it breaks search and breaks the admin console (search 500s and admin console puts up the "exception" screen).  It seems this is because the Algolia install didn't install all files.  E.g. (from exception.log):

  exception 'Mage_Core_Exception' with message 'Invalid block type: Algolia_Algoliasearch_Block_Adminhtml_Notifications' in /home/cluster-sites/5/y/yateley10kseries.kallisti.co.uk/public_html/app/Mage.php:595

and system.log:

  2018-07-04T12:55:47+00:00 ERR (3): Warning: include(/home/cluster-sites/5/y/yateley10kseries.kallisti.co.uk/public_html/includes/src/Algolia_Algoliasearch_Model_Observer.php): failed to open stream: No such file or directory  in /home/cluster-sites/5/y/yateley10kseries.kallisti.co.uk/public_html/includes/src/Varien_Autoload.php on line 94

OK - so it's obvious the problem - incomplete install - but the little green Magento Connect install screen said it went fine...?  Is there a log of that somewhere I could use to debug?


texts:
i found this solution for display a banner between the products grid view.
The code show the banner every 4th product but i will show the banner only once after the 4th element.

My code which is based after the  inside the /catalog/product/list.phtml:

<?php if($i % 4 == 0){ ?>
   <li class="advert-banner-first">
      <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('catalogfirstbannermarkthalle')->toHtml(); ?>
   </li>
<?php } ?>

Thanks, for help.

Here is the complete question: https://stackoverflow.com/questions/9873175/magento-banners-bewteen-products


texts:
I'm trying to send a request to Walmarts API but am getting a 'malformed' error when sending my GET request, hoping someone could help. Below is my code

class Admin2 {

    function __construct() {

    }
public function pkcs8_to_pem($der) {

      static $BEGIN_MARKER = "-----BEGIN PRIVATE KEY-----";
      static $END_MARKER = "-----END PRIVATE KEY-----";

      $value = base64_encode($der);

      $pem = $BEGIN_MARKER . "\n";
      $pem .= chunk_split($value, 64, "\n");
      $pem .= $END_MARKER . "\n";

      return $pem;
  }

  public function getClientSignature($url, $request_type, $timestamp) {
      // Your walmart info from walmart admin
      $walmart_secret = 'XXXXXXXXXXXXXXXXX';
      $walmart_consumer_id = 'XXXXXXXXXXXXXXXXX';

      // Get an openssl usable private key from the walmart supplied secret
      $pem = $this->pkcs8_to_pem(base64_decode($walmart_secret));
      $private_key = openssl_pkey_get_private($pem);

      // Construct the data we want to sign
      $data = $walmart_consumer_id."\n";
      $data .= $url."\n";
      $data .= $request_type."\n";
      $data .= $timestamp."\n";

      // Sign the data
      $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
      if (!openssl_sign($data, $signature, $private_key, $hash)) {
        // ERROR
        return null;
      }

      return base64_encode($signature);
  }

  public function walmartAPI(){

      if (!extension_loaded('openssl')) {
            'no openssl extension loaded.';
        }

     // Your walmart info from walmart admin
    $walmart_consumer_id = 'XXXXXXXXXXXXXXXXX';
    $walmart_channel_type = 'XXXXXXXXXXXXXXXXX';

    $request_type = "GET";

    $url = "https://developer.walmart.com/proxy/item-api-doc-app/rest/v3/feeds?includeDetails=false&offset=0&limit=50";
    $url = urlencode ( $url );

    // We need a timestamp to generate the signature and to send as part of the header
    $timestamp = round(microtime(true) * 1000);

    $signature = $this->getClientSignature($url, $request_type, $timestamp);

    $headers = array();
    $headers[] = "Accept: application/xml";
    $headers[] = "WM_SVC.NAME: Walmart Marketplace";
    $headers[] = "WM_CONSUMER.ID: ".$walmart_consumer_id;
    $headers[] = "WM_SEC.TIMESTAMP: ".$timestamp;
    $headers[] = "WM_SEC.AUTH_SIGNATURE: ".$signature;
    $headers[] = "WM_QOS.CORRELATION_ID: ".mt_rand();
    $headers[] = "WM_CONSUMER.CHANNEL.TYPE: " .$walmart_channel_type;

    $ch = curl_init($url);

    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_URL,$requestUrl);
    curl_setopt($ch, CURLOPT_HEADER, TRUE);
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_type);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $result = curl_exec( $ch );

    if(curl_errno($ch)):
        echo 'Curl error: '.curl_error($ch);
    endif;

    $xml = simplexml_load_string($result);

     print_r($xml);

  }

} // end class

$admin2 = new Admin2();

echo $admin2->walmartAPI();


texts: HTML tags are not allowed in footer copyright

texts:
I just wanted to change my theme config and it gives me this error on Footer Copyright section:

  HTML tags are not allowed.

=> Screenshot :

But if I make this copyright empty and Save the configuration, This error will not show anymore and configuration save would be successfully. but after returning to configuration page default value of copyright will be pulled there and I cant save configuration again.

I tried to upgrade Magento to 2.1.8 version (by composer) and changing theme to default Magento theme (Magento Black), but nothing changed!

can you please help me how to solve this error?

I need hyperlink in my copyright section, so how can I do that?

Thanks in advance.


texts: TypeError: element.prop is not a function - Magento 2

texts:
In product detail page I got below error in browser console at app/code/Magento/PageCache/view/frontend/web/js/page-cache.js

TypeError: element.prop is not a function
.prop('href', element.prop('src'))

here I found one fix, but after that one new error appear that is

Error: Permission denied to access property "document" in http://domainname/pub/static/frontend/Vendor/theme/en_US/jquery.js

note: In luma theme product detail page works fine without any fix in page-cache.js
can anyone have an idea about root cause of the problem?


texts: Override tax rate on programmatically created order

texts:
I'm building an extension which imports orders created on a third-party system into Magento. The third-party system should be the single source of truth for the order's prices, tax rate, tax paid, etc.

When creating a quote item for each order line to be imported, I can successfully override the product's price with setOriginalCustomPrice and setCustomPrice. Essentially, I'm looking for a way to do the equivalent for the tax rate (or even just the tax paid).

I've attempted using setTaxPercent, setTaxAmount, setBaseTaxAmount, etc. to no avail. I've seen suggestion of hooking into sales_quote_collect_totals_before, but I don't want to effect any orders created on the front-end of the Magento store (i.e. orders not from the third-party system).

Can someone please point me in the right direction!


texts:
I am only able to install 1.9.1 with the following command:

./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force


texts: Magento 2.1 - Sitemap XML Doesn't change to HTTPS

texts:
Use Secure URLs on Storefront = Yes

Use Secure URLs in Admin = Yes

Secure Base URL = starts with HTTPS

Why does my sitemap not start each link with https?


texts: Found 2 major bugs in magento 2 when creating orders through the admin, temp solution anybody?

texts:
Issue 1.

On a multistore with different prices when you hit the button update qty the wrong price is suddenly assigned to the products.

https://github.com/magento/magento2/issues/15846

Issue 2.

On a multistore with different tablerates the wrong shipping price is used. Looks like he always uses website ID 1.

https://github.com/magento/magento2/issues/16604

Just wondering if anybody found a solution I can use and then pray the dev team will really fix it :-)


texts: Best way to convert configurable products to simple products

texts:
A client has a lot of configurable products which contain just one simple product. The thinking behind this is that it will be easier to add products when the manufacturer ads new variants of the products.

The problem we have now is that every time a visitor selects the options, he finds just one option. for example: A T-shirts has just one color and one size selectable via the dropdown selectors.

I'm looking for a solution to convert all configurable products which have just one associated product assigned to it to a regular simple product.

can this be done by doing an export and finding all configurable products with just one simple product and by copy and paste the image url etc..

Hopesomeone has the answer.


texts:
I am working with checkout component file (JavaScript) and I don't understand how to decrypt encrypted value in JavaScript. Found that there is no JS file under framework/Encryption module.

Any help and suggestion will be appreciated. Thank you.


texts: "Fatal Error: 'Out of memory' (allocated 202440704) (tried to allocate 20480 bytes) Magento 2.4.1

texts:
I'm using Magento version 2.4.1 hosted on AWS EC2 and using AWS ElastiCache for Redis (5.0.6) to store session
bin/magento --version
Magento CLI 2.4.1
We previously encountered issue with memory limit as below
"Fatal Error: 'Allowed memory size of 792723456 bytes exhausted (tried to allocate 4096 bytes)' in '/home/demo.7hit.vn/release/1610350759/7hit/vendor/magento/module-csp/Model/BlockCache.php' on line 78"
Per our understanding, the value was limited to 756MB. Then we updated value inside .user.ini, php.ini and now we're facing out of memory issue when checking report/api
"Fatal Error: 'Out of memory (allocated 482934784) (tried to allocate 20480 bytes)' in '/home/demo.7hit.vn/release/1611044763/7hit/vendor/magento/framework/Serialize/Serializer/Json.php' on line 37
"Fatal Error: 'Out of memory (allocated 202440704) (tried to allocate 20480 bytes)' in '/home/demo.7hit.vn/release/1611044763/7hit/vendor/magento/framework/Serialize/Serializer/Json.php' on line 37
[root@ip-10-0-3-88 current]# php -r "echo ini_get('memory_limit').PHP_EOL;"
-1
[root@ip-10-0-3-88 current]# php -i | grep memory
memory_limit => -1 => -1
Collecting memory statistics => No
output of 2 files [Magento-root-folder]/.user.ini and [Magento-root-folder]/pub/.user.ini
memory_limit = -1
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off
value inside /etc/php.ini
; Default Value: -1 (Unlimited)
; http://php.net/memory-limit
memory_limit = -1
output of free -m
[root@ip-10-0-3-88 pub]# free -m
          total        used        free      shared  buff/cache   available

Mem:           7525        3302        2845          24        1377        3901
My colleague reported that restarting AWS ElastiCache sometimes helps to resolve the issue. I'm not sure if they're relevant to each others. Is there anyone help us to understand the root cause and how to fix it.?
Thanks a lot!


texts:
When I press on proceed  I got this error on Magento Connect :

Invalid Post Data

How can I fix it ?
Directory Permission ?


texts: Using LESS variables in extended LESS file Magento 2

texts:
I need to use LESS Variables in my extended LESS file in my theme.

I've this code in my _extend.less in this location My_Magento\app\design\frontend\<My_Vendor>\<My_Theme>\web\i18n\fa_IR\css\source\_extend.less :

@import '_rtl.less';

and in the _rtl.less file:

.myClass{
    background: @color_theme;
}

Note that the @color_theme defined in the Parent Theme in this location  My_Magento\app\design\frontend\<Parent_Vendor>\<Parent_Theme>\web\css\_general.less

So when I run:

php bin/magento setup:static-content:deploy

It will throw some errors like this:

variable @color_theme is undefined in file C:/xampp7/htdocs/My_Magento/var/view_preprocessed/css/frontend/<My_Vendor>/<My_Theme>/fa_IR/css/source/_rtl.less in _rtl.less on line 20, column 15

It will happens for any variable of any LESS Styles included in Parent Theme or Modules etc. in my _extend.less theme file!

How can I use LESS Variables from other sources (Parent Theme or Modules LESS files) in my _extend.less file?

I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2.

Thanks.


texts: Magento 2 : How To Add Cms Block on Home Page After Megamenu

texts: I need to create a link from cms block to the home page to render the contents in storefront.


texts: Magento 2.3.2 Production mode not working

texts:
i have run production command but not working

php bin/magento deploy:mode:set production

when I run deploy command

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

and Below type Error showing

  Command returned non-zero exit code: `/opt/alt/php71/usr/bin/php -f

When i run Below deploy command and working Fine but i can not set to production mode

php bin/magento setup:static-content:deploy


texts:
I have a multi store view with different languages to describe the product. Each store has a different locale defined.

I have this code

    $shops = $this->_storeManager->getStores();

    $store_locales = array();
    foreach ($shops as $shop){

        $store_locales[$shop->getName()] = array();
        $store_locales[$shop->getName()][] = $shop->getId();
        $store_locales[$shop->getName()][] = $this->_scopeconfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shop->getId());

    }

and now i need to load a product desciption specifying a store id.

Any idea?


texts:
I am trying to use login session on magento/catalog/view/base/templates/product/price/amount/default.phtml
to hide price from users not logged in.

However, it seems not working well with

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
    // customer login action
}

As well, I cannot find \Magento\Framework\App folder in my project. But, it seems working well tho. Is there any way that I can find this folder, and that makes it able to get login status?


texts:
Can't locate Magento 1.9 cache anywhere on FTP. Any ideas how to find it?

Of course I've already checked the usual places like /var/cache but it's just not there. Any ideas on how to find it?


texts: After restoring magento2 from backup file, frontend design is broken, not loading CSS and JavaScript

texts:
I think I tried all the suggested method. But not working.

php bin/magento setup:static-content:deploy

php bin/magento indexer:reindex

I also deleted cache, changed permission of pub/static to 777.
Nothing did help.

Admin login page design is also broken. But once logged in, then everything looks fine.

On the browser, error message says, "404 not found" and "Script from [URL] was blocked due to mime type mismatch" for the css and javascript files

What could be wrong?


texts: get available payment method in magento store

texts:
how can i get list of payment methods with detaile like code,title,method and?
is it possible get available payment method in store with API ?


texts:
Getting this error -

  Fatal error: session_start() [function.session-start]: Failed to
  initialize storage module: user (path: /tmp) in
  app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 125

Any help would be appreciated.


texts: Magento 2.3 secure your site back and front

texts:
Got a very security conscious client.

I've searched stack exchange and only found partial solutions to certain security issues.

I've also searched dev docs and again found one or two suggestions in different areas.

Therefore I felt it was worth asking the question to get a collection of answers under a single question.

Does anyone have practical suggestions on making magento 2 (more) secure front and back? Either extensions or configuration.  Or perhaps even just some common sense rules to follow.  Like disabling something that's enabled by default.


texts: How to get default selected customer shipping address?

texts:
if (is_null($this->_address)) {
    if ($this->isCustomerLoggedIn()) {
        $this->_address = $this->getQuote()->getShippingAddress();
    } else {
    $ship = $this->getQuote()->getShippingAddress();
    $ship_country = $ship->getCountryId();
    if(!empty($ship_country))
        $this->_address = $ship;
    else
        $this->_address = Mage::getModel('sales/quote_address');
    }
}

Please reply if you have any idea.

Thanks.


texts: Assign template of block via virtualType in Magento 2?

texts:
It's possible to assign template of the block via virtualType?

app/code/Vendor/Module/etc/frontend/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="cartItemRendererCustom" type="Vendor\Module\Block\Checkout\Cart\Item\Renderer\Custom">
        <arguments>
            <argument name="template" xsi:type="string">Vendor_Module::checkout/cart/item/renderer/custom.phtml</argument>
        </arguments>
    </virtualType>
</config>

In my Plugin, I can call the virtual type block:

$block = $this->layout->createBlock('cartItemRendererCustom');

However, I cannot assign the template. I followed this answer: How to reuse Block Product Video in magento 2


texts:
I have seen this asked before but a lot of the answers I found where people looking to get a variable into a modal to query a database. However thats not what I want. I just want to send a variable into s modal.

Here is my button the activated the bootstrap modal

<button class="btn btn-primary btn-xs" data-toggle="modal" data-target="#myModalNorm" data-id="<?php echo "$issueid";?>">Add New Followup

Then I have a modal code as below. I want the value from data-id to show in the text box named caseid

                <button type="button" class="close"
                   data-dismiss="modal">
                       &times;
                       Close
                </button>

                    Modal title

                <form role="form" method="POST" action="./view_customer?cid=<?php echo "$cid";?>">
                  <input type="text" id="casenoteid" name="caseid" />

                    The Issue
                      <input type="text" class="form-control" name="issuenote" id="issuenote"/>

                  <input type="submit" class="btn btn-default" value="SAVE NOTE" name="savenote">
                </form>

                <button type="button" class="btn btn-default"
                        data-dismiss="modal">
                            Close
                </button>
                <button type="button" class="btn btn-primary">
                    Save changes
                </button>

then I have the jquery


texts: how to display purchase order number in customer dashboard frontend?

texts:
I am using Magento 2.1 .
I want to display purchase order number in customer dashboard.


texts:
magento2.3
I do not need to display product images.
I edited list.phtml, but nothing happens.
Does anyone have any idea？


texts: Which implementation is used if there are multiple implementations of service contracts?

texts:
I was going through the service contracts and their implementation in customer module.
Suppose we are using multiple implementations of the same service contract present in the Api/ directory of a module.
Now if we are using this interface in a controller let's say. Then which implementation will be considered?
For example, there is an interface Magento\Customer\Api\AccountManagementInterface
This is implemented in Magento\Customer\Model\AccountManagement
Now in Magento\Customer\Controller\Account\ResetPasswordPost we are using AccountManagementInterface
$this->accountManagement->resetPassword(
            null,
            $resetPasswordToken,
            $password
        );

If, let's say, I have 2 implementations of the same interface AccountManagementInterface, then which implementation will be used here?
Will module sequence be considered in this case? Sorry if my question is silly.


texts: Magento 1.9 - Upload multiple files from product view page front end

texts:
I am using product custom option "input type file" to upload multiple files from front end (for customer) but can't upload multiple files.

I need help to uploads multiple files from front end using single input(File).
After uploads, files name should be shown on cart page and in order detail.

Thanks


texts:
I have a completely fresh install of Magento 2.1.2 installed via Composer. I am attempting to install a module called "Advanced Content Manager 2" which is said to be compatible with Magento 2.1 and below.

My problem is that no matter what method I use, I can not get the module to install and every time it seems to completely break the Magento install, requiring a fresh re-install.

I have tried installing via the admin panels Component Manager. When I do this, the module shows as available, all readiness checks and backups succeed. However when I go to perform the install the console log gets stuck in a loop of seemingly enabling/disabling maintenance mode. Trying to recover from the backup always fails.
When I install via command line manually, as documented @ http://www.advancedcontentmanager.com/documentation/m2/general/installation-guide I only get Unknown module(s): 'Blackbird_ContentManager' as a response.

I have tried to manually move the module folder around within the project but it never appears within the command line request to list modules and installing always fails to find the module.

Can anyone point me to documentation that actually outlines the correct method?


texts: Magento2 getting single row by field from repository object

texts:
I am building an ajax using webapi. and it instantiates a repository model.
How do I load a single row by a field?
I need to check if an email already exist in the table.


texts:
On the site I'm currently working on, there is a tabbed area for new products and supposed to have a "most viewed" tab, but "most viewed" doesn't seem to appear - even after clearing caches - whilst new products does.

I've created a new module for it at /app/code/local/VendorX/MostViewed with the following files:

etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <VendorX_MostViewed>
            <version>1.0.0</version>
        </VendorX_MostViewed>
    </modules>
    <global>
        <blocks>
            <vendorx_mostviewed>
                <class>VendorX_MostViewed_Block_MostViewed</class>
            </vendorx_mostviewed>
        </blocks>
    </global>
</config>

Block/MostViewed.php

class VendorX_MostViewed_Block_MostViewed extends Mage_Core_Block_Template
{
    public function getMostViewedProducts()
    {
        $storeId = (int) Mage::app()->getStore()->getId();

        // Date
        $date = new Zend_Date();
        $toDate = $date->setDay(1)->getDate()->get('Y-MM-dd');
        $fromDate = $date->subMonth(1)->getDate()->get('Y-MM-dd');

        $collection = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
            ->addStoreFilter()
            ->addPriceData()
            ->addTaxPercents()
            ->addUrlRewrite()
            ->setPageSize(6);

        $collection->getSelect()
            ->joinLeft(
                array('aggregation' => $collection->getResource()->getTable('sales/bestsellers_aggregated_monthly')),
                "e.entity_id = aggregation.product_id AND aggregation.store_id={$storeId} AND aggregation.period BETWEEN '{$fromDate}' AND '{$toDate}'",
                array('SUM(aggregation.qty_ordered) AS sold_quantity')
            )
            ->group('e.entity_id')
            ->order(array('sold_quantity DESC', 'e.created_at'));

        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

        return $collection;
    }
}

app/design/frontend/vendorx/website/layout/local.xml

...
<block type="core/template" name="featured_tabs_2" template="catalog/product/list/featured/tabbed.phtml" after="-">
                <action method="setTitle"><title><![CDATA[Best Selling Clubs]]></title></action>
                <block type="catalog/product_new" name="new-products" as="new-products" template="catalog/product/list/featured.phtml">
                    <action method="setHeading"><heading>Just Arrived</heading></action>
                    <action method="setCacheLifetime"><lifetime>86400</lifetime></action>
                    <action method="setCacheKey"><key>hp_new_prods</key></action>
                </block>
                <block type="vendorx_mostviewed/mostviewed" name="most-viewed" as="most-viewed" template="catalog/product/list/featured.phtml">
                    <action method="setHeading"><heading>Most Viewed</heading></action>
                    <action method="setCacheLifetime"><lifetime>86400</lifetime></action>
                    <action method="setCacheKey"><key>hp_most_viewed</key></action>
                </block>
            </block>
...

I have run through xdebug and for some reason it is not going in to the mostviewed class (as defined on the block type) and when I change the block type to catalog/product_new I get some products on the front end showing (albeit the same as the new-products tab block.

Any help would be massively appreciated.


texts: Adding a non-category link to the navigation links in magento 2

texts:
I'm not sure what I'm doing wrong here. The block which holds the category links in is referenced to as navigation.sections. I thought by directing the following arguments toward the container I would be able to create a new link under it. Any help is appreciated.

<referenceContainer name="navigation.sections">
            <block class="Magento\Framework\View\Element\Html\Links" name="mylink">
                    <arguments>
                        <argument name="label" xsi:type="string">Mylink</argument>
                        <argument name="path" xsi:type="string">mypath</argument>
                        <argument name="css_class" xsi:type="string">mycss</argument>
                    </arguments>
            </block>
</referenceContainer>


texts:
I installed varnish 5.2 and Magento 2.3.2 after that I check the varnish header and it worked very well but after move default.vlc it does not work.
this is my default.vlc

https://pastebin.com/Bz7WA1RB

where I am going wrong?


texts: Magento not saving custom product attributes after version upgrade

texts:
I upgraded a Magento 1.7.0.2 to 1.9.3.4 and now (three months later) I have some troubles with custom product attributes.

1) One of them is dropdown. I select the option, I save the product and the attribute is well saved. But when I edit the product again, the current attribute option is not selected. When I edit the product, the dropdown field is blank, with no option selected.

2) Another attribute is text field. I replace the old text with a new one, but after I save it, the old text continue to appear, so I guess it doesn't save the attribute at all.

There are no javascript/php errors.

Any idea/sugestion will help. Thanks.

EDIT

As far as I've tested, this issues affect only the products from the old website. These products were exported from the old website and later imported to the new website (Using Magento's System/ Export and later System/ Import functionality). I can edit other attributes without any issue.

I wasn't able to reproduce these issues when creating new products on the website.


texts: Magento Enterprise Edition Custom Customer Address Attribute

texts:
I've added custom customer address attribute through the admin panel. The attribute value is inserting in customer_address_entity_int table but attribute value is not displaying in Customer Grid.

Any Help. Thank you.


texts: Magento 2 etc folder location for Development

texts:
I'm developing using Magento (2.3) for the first time.

I am building a Widget which goes hand in hand with an API.

The structure I believe will work under app/code is:

- /Company
  - /Product
    - /Api
      - registration.php
      - /etc
        - di.xml
        - module.xml
        - webapi.xml
    - /Widget
      - registration.php
      - /etc
        - module.xml
        - widget.xml

Will this work? Or does the /etc folder have to come up one level like this:

- /Company
  - /Product
    - /etc
      - di.xml
      - module.xml
      - webapi.xml
      - widget.xml
    - /Api
      - registration.php
    - /Widget
      - registration.php

If this is the case, how do I deal with the multiple module.xml files? can I place multiple "module" elements in the "config" element?

EDIT 1
So it needs to be:

- /Company
  - /Product
    - registration.php
    - /etc
      - di.xml
      - module.xml
      - webapi.xml
      - widget.xml
    - /Api
    - /Widget

Can I have module.xml as follows:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Company_Product_Api" setup_version="1.0.1">
        <sequence>
            <module name="Magento_CatalogWidget"/>
        </sequence>
    </module>
    <module name="Company_Product_Widget" setup_version="1.0.1">
        <sequence>
            <module name="Company_Product_Api"/>
        </sequence>
    </module>
</config>

And registration.php as follows:

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Company_Product_Api',
    __DIR__
);
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Company_Product_Widget',
    __DIR__
);

EDIT 2:
So based on Marius' Answer i've ended up with the following. I am not sure its 100% right yet as the API is returning me a 400 error.

- /Company
  - /Product
    - registration.php
    - /etc
      - di.xml
      - module.xml
      - webapi.xml
      - widget.xml
    - /Api
    - /Block
    - /Model
    - /view


texts: Where is set the variable $this->helper('wishlist')->isAllow()?

texts:
I can see in phtml files some tests like:

 <?php if ($this->helper('wishlist')->isAllow()) : ?>

I want but to know where is set this variable (isAllow or not)?

I am using Magento ver. 1.7.0.2

Thanks a lot.


texts: How does Magento handle multiple stores on the same domain

texts:
I've been asked to scope out a move to multisite Magento, introducing a second store that uses a different currency and pricing.

However, we do not wish to redirect customers to a new URL to use the new site, only display the different pricing in the other store view when they choose the other store using the default store switcher.

Can Magento handle serving multiple stores from a single URL, or does it need some difference to render route properly?


texts: How to include a new order status in between pending and processing in magento 2.1

texts: I want to include a new order status in between pending and processing.  i.e., after placing an order the status is pending and after this, I want to change to [New order status] and then processing status, when we click on a ship action, it changes. Suggest me, how to do this.


texts: Display items custom options in magento onestepcheckout

texts:
I have been struggling for almost 10 hours, how to achieve desired view of my onestepcheckout. I have downloaded Uni_Opcheckout extension and it is working ok, but in checkout review table is only product name in one line:

but I want my review table to look like:

Code that generates first view is located in opcheckout\onepage\review\info.phtml

    <?php foreach($this->getItems() as $_item):?>

        <?php echo $_item->getName() ?>
        <?php echo $_item->getQty() ?>
        <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>

    <?php endforeach ?>

Can anyone help with this, please?

Regards


texts: Magento2.3: How to remove others in general at registration form?

texts:
In account registration form, we have a gender field, on that there are three options as Male, Female and Others. I want to remove Others in registration form.

How can I remove that?

Any help will be appreciated!


texts: Magento 2 : How can I add discount to a custom option

texts:
I have a product with custom options and a catalog price rule (that applies to a certain customer group). When your in this customer group (group X), you get a discount of 15%.

This works for the product price, but not for custom options. For example: if I have a product of EUR 100,- with a custom option that costs EUR 10,- and I apply a discount of 15%, the resulting price is not EUR 93.50 (85.00 + 8.50), but EUR 95.00 (85.00 + 10.00).

I've created a plugin for Magento\Quote\Model\Quote\Item\Processor to be able to set a custom price:

<!--
    Plugin for price manipulation
-->
<type name="Magento\Quote\Model\Quote\Item\Processor">
    <plugin name="price_manipulation" type="Vendor\Module\Plugin\Magento\Quote\Model\Quote\Item\Processor"/>
</type>

Processor.php:

class Processor
{
    /**
     * Manipulate the price
     *
     * @param \Magento\Quote\Model\Quote\Item\Processor $subject
     * @param \Magento\Quote\Model\Quote\Item $item
     * @param \Magento\Framework\DataObject $request
     * @param \Magento\Catalog\Model\Product $candidate
     * @return array
     */
    public function beforePrepare(
        \Magento\Quote\Model\Quote\Item\Processor $subject,
        \Magento\Quote\Model\Quote\Item $item,
        \Magento\Framework\DataObject $request,
        \Magento\Catalog\Model\Product $candidate
    ) {
        // $request->setData('custom_price', 999);

        return [$item, $request, $candidate];
    }
}

But at this point in the code I don't have the discounted base price. So when I ask $item->getPrice() I get NULL. I guess I'm too early in the chain here. And when I ask $item->getProduct()->getPrice()` I get the non-discounted price, so that's also not what I want.

Can anyone share some insight in how to apply discount to custom options?


texts:
I am looking for information about how i should be do by to wysiwyg Magento Styles editor work´s.
due that from default, this function is not available.


texts: CMS Page Save - Url Key - "The value specified in the URL Key field would generate a URL that already exists"

texts:
I've upgraded to Magento 2.3.6 from 2.3.4 and am encountering this error anytime I try to update and save a CMS Page. It's limited just to CMS pages. Products and Categories are fine.
The error is: "The value specified in the URL Key field would generate a URL that already exists"
It doesn't matter what I update, it will still produce this error. The same when creating a new page.
I've tried truncating the url_rewrite table to no avail.
I can't see what is producing this error - there is simply not a Url Key in there that exists.


texts: I need to  display custom option only if previous custom option selection is 'Yes'. Do you have any tips on how to do this?


texts: How to share cart for guest users between multi stores with different domain

texts:
I am able to share my cart for logged in customers while switching between two stores with different domain URLs. However, I could not implement the same for guest users. I know the cart details are saving into the quote table. But this is not shared with the second store while switching.

Please guide me to a solution.


texts: Magento Security Scan enforcing Google Recaptcha?

texts:
I made a Magento shop for a client.
The only stain on the MSS report is the fact that I'm not using Google Recaptcha in the customer registration form.
For probable GDPR reasons, but mostly personal ethics ones, I don't want Google to have anything to do with the websites I create (I use anonymized logs with Matomo for statistics for example).
Also Google Recaptcha is a PITA if your not using Chrome, and refrain some older customers (this shop is senior oriented)
The problem is that my payment kit provider (a bank) is telling me that not having a clean Magento Security Scan report is bad, and they can stop our contract.
Is there a way to please the MSS without using this forced tier product ?


texts: Why is Magento admin URL so long and complicated on lcoalhost?

texts:
I have just uploaded Magento on localhost and its URL is simply this localhost/magento but when I go on its admin part i.e localhost/magento/admin part url redirects to a very complicated & unexpected url i.e http://localhost/magento/admin/admin/dashboard/index/key/d0635adba364ac457fb10aa4f6147b02c983c632402595b88482d7956d7accf0/.

Please help me out that how can overcome from this problem? I have earlier uploaded its previous version but then I have not face this type of problem but that I had uploaded directly on server not on localhost.


texts: Call to a member function setStore() on a non-object in magento

texts:
I have created custom shipping module and gets following error:

Fatal error:  Call to a member function setStore() on a non-object in /home/devjoand/public_html/includes/src/Mage_Shipping_Model_Shipping.php on line 421

I removed all files including .xml for this shipping module and it still gives me the same error. It doesn't send me to shipping method and stops execution from savebilling controller with above error. I have cleared cache/session and recompile but nothing works. Any help would be appreciated. Thanks in advance!

NOTE: It works fine in my local machine but not working on production server.


texts: Call one function inside another controller function not working

texts:
Guest user enters details and click on "submit" to register. It's working fine for below code :

<form action="<?php echo $this->getUrl('example/amasty/create1'........>

Here we are using the following controller action : getUrl('example/amasty/create1

Instead of this, if we change the controller as below and change the form, then the registration is not working anymore.

<form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect1'....>

  Controllers

public function createSimpleProductAndRedirect1Action()
    {
        $originalProductId = $this->getRequest()->getParam("id");
        $newImagePath      = $this->getRequest()->getParam("image");
        $originalProduct   = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($originalProductId);

        if ($product = $this->_create1(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, true, $originalProduct, $newImagePath)) {
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode("Your Image Saved"));
        }
    }

protected function _create1Action()

Here we replaced controller action to example/amasty/createSimpleProductAndRedirect1

  update

:

Fatal error: Call to undefined method Amasty_Example_AmastyController::_create1()` in

if ($product = $this->_create1(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, true, $originalProduct, $newImagePath))


texts: Magento 1.9 CMS block custom field is not saving values

texts:
I already checked all similar posts but still don't know why it won't work for me.
Manually added columns into the table "cms_block", also added all required fields in to the form.php and now in admin everythig seems to be ok except if I change anything (except original fields ... those works).
What I've done: added fields to the form.php, created new fields in cms_block table.


texts:
I am using admin grid where I have product grid. In product grid I have action as of now this is link redirecting to new page. But I want when I click on link it open as popup. Like when we adding attribute while creating product

Any ideas how we can do this?


texts: Magento 2 - separate registration form to register into customer group with custom field

texts:
I want to add a separate registration form in Magento 2 store with the users directly go into a particular Customer Group and also I want to show up some custom fields too.

More explanation:

I have a customer group "dealer" and I want to create separate user registration form when the user's register, there directly go into "dealer" group and also I want to show some custom fields too (these fields should not show up on the default registration form of the M2 store)

What I did is:

The registration form is coming from
    /app/design/frontend/Mgs/claue/Magento_Customer/templates/form/register.phtml

So I duplicated that to

/app/design/frontend/Mgs/claue/Magento_Customer/templates/form/dealerregister.phtml

And tried calling this form into CMS page by
     {{block class="Magento\Customer\Block\Form\Register" template="Magento_customer::dealerregister.phtml"}} but not gettnig anyouput on the page.


texts: Magento 2.4 PWA : How to setup with LEMP stack using Docker

texts: If someone setup Magento 2.4 PWA using Docker with LEMP stack... Please give me supports.


texts: Remove decimals from configurable option price update script

texts:
I changed app/code/core/Mage/Directory/Model/Currency.php to not use decimals.
This works good for me besides the price update for configurable options.
If I choose option I still get 123.00 but I want it to be 123.

Any ideas?

Thx


texts: In Magento 2 will new sales overwrite migrated sales orders?

texts:
I'm currently migrating an existing Magento 1 site to Magento 2 and I wondered how the sales number would behave after migrating data.

We’ve migrated all of our existing sales data from our Magento 1 system but I wondered how this worked with the new orders on the Magento 2 system.

The Migration tool (Ubertheme) seems to have kept the original ID numbers for our sales orders (which I’m happy about as it makes them easier to search) but as the new orders seem to reset the counter. I wondered how this would work when the numbering “caught up” with the migrated orders.

I realize that this is something that, most likely, has already been considered but I just wanted to make sure that the new orders will not conflict with/overwrite the original sales orders.


texts: Magento2: Insert data into a custom table on product creation?

texts:
How to insert data into a custom table on product creation in Magento2

Any help would be appreciated.


texts: is there an way, that the cart calculate the total weight and multiply with the highest product rate for example if i have 6 items of ShiptypeA and 4 items of ShiptypeB = 21.99 Euro by the ShiptypeB  rule for 5 kg ?


texts: When signing into Magento admin, it initially allows me to sign in, but when I click any link in the admin, it boots me out. Why?

texts:
Basically whenever I try to login to the Magento admin, it initially works fine, but as soon as I click on a link, it boots me out. When I log back in, everything works fine.

There's also some weird behavior in that I have to clear the cache anytime I need to run a sales report (or any other report.)


texts:
I'm trying to override the following file and I need the changes to show in adminhtml.

vendor/magento/module-customer/view/base/ui_component/customer_form.xml

I have copied the file to the location below and made the changes.

app/code/[vendor]/[module]/view/base/ui_component/customer_form.xml

However the changes aren't showing up.

Tried a few different places such as overrides/adminhtml etc. I've also tried just including the fields/arguments I want to change and searching for the proper way to overwrite this file but haven't been able to get it working yet.

Edit: adding code of xml file after request

My first attempt was to copy the entire file and only change the value I needed (switching lastname validation to false). So that should be same as core except those two values. My second attempt to override the file only including the fields I changed is below.

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="customer">
        <field name="lastname">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">customer</item>
                    <item name="validation" xsi:type="array">
                        <!-- this should work but doesn't appear to, needed to do a core hack instead -->
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
    <fieldset name="address">
        <field name="lastname">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">address</item>
                    <item name="validation" xsi:type="array">
                        <!-- this should work but doesn't appear to, needed to do a core hack instead -->
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                    <item name="imports" xsi:type="array">
                        <item name="default" xsi:type="string">${ $.provider }:data.customer.lastname</item>
                    </item>
                </item>
            </argument>
        </field>
    </fieldset>
</form>


texts:
I added the following code under design tab in footer area

<img title=”Accepting MC, VISA, AMEX, DISCOVER” src=”https://inspirer.ca/credit_card_logos_16.jpg” alt=”Accepting MC, VISA, AMEX, Discover” width=”336″ height=”50″ />

But the front page shows me

Thanks


texts:
I am unable to reindex product prices, it always show the message

  Cannot initialize the indexer process.


texts: Magento 2.3 create order programmatically

texts:
I am creating order programmatically in Magento 2.3.3

foreach ($orderData['items'] as $item) {
    $product = $this->_productFactory->create()->load($item['product_id']);
    $product->setPrice($item['custom_price']);
    $product->setStatus(1);
    $product->setIsInStock(true);
    $product->setStockData(array(
            'use_config_manage_stock' => 0, //'Use config settings' checkbox
            'min_sale_qty' => 1, //Minimum Qty Allowed in Shopping Cart
            'is_in_stock' => 1, //Stock Availability
        ));

    //To fix min sale qty different issue
    $productStockObj = $this->stockRegistryInterface->getStockItem($product->getId());
    $productStockObj->setData('min_sale_qty', 1);
    $productStockObj->setData('use_config_manage_stock', 1);
    $productStockObj->setData('use_config_min_sale_qty', 1);

    $quote->addProduct(
        $product, intval($item['qty'])
    );
}

I am creating an order for Disabled and Out of Stock products.

This code was working fine before in Magento 2.2 but now I'm getting an error like This product is out of stock. when product is Disabled or Out of Stock in the admin.

I have also changed the Admin setting as below.

Catalog > Inventory > Stock Options > Decrease Stock When Order is Placed = No
Inventory > Product Stock Options > Manage stock = No
Inventory > Product Stock Options > Backorders = Allow QTY below 0


texts: I would like to get the password of the old customers of the old bank and pass to a new bank, I give a getPasswordHash and it brings me an encrypted password, I try to insert it into the bank but when I do a test the password is not the same.


texts: Multiple Downloadable Product Purchased through a single order Title Issue

texts: Purchasing the Multiple Downloadable Product in single Order. In admin order Shows First Product downloadable link to all other Products downloadable Title.  Getting ISsue. Please Help me !


texts: How to set a Special Price and block all coupons for it

texts: Using Magento 1.4.0.1 and want to put an item on sale using a Special Price. I don't want customers to use a coupon to further discount it.  This applies to one SKU only. I have over 500 coupons so I can't go into each coupon and exclude this item.  Any suggestions?


texts: What's the proper way to create Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface without objectmanager?

texts:
I can't find the factory for this data object. I don't see it in the generated folder, nor do i see any references online. What's the best way to create this in my module? aside from using objectManager.

 Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface


texts: Transparent Data Encryption in Magento 2.3 Database

texts:
I need to encrypt customer data (company name, contact person, emai, address, etc.) within the magento mysql database.

I'd like to realize this without introducing encryption/decryption in every module where customer data is used. I think of a solution similar to the transparent data encryption (TDE) known from oracle.

How could I realize a transparent data encryption for the magento 2 database? If this is not possible what would be the best alternatives?

Thank you in advance!


texts: How to import product include entity_id?

texts: I want to import products with the existing id. ex: I have products which id start from 200. How can I import those products to magento product table which will start from 200 also?


texts: Magento 2 - How to catch Exception when run batch file?

texts:
When I ran my batch file and get Excetion below:

I try to catch exception but I can not catch. My code sample is below:

/**
 * {@inheritdoc}
 */
protected function execute(InputInterface $input, OutputInterface $output)
{
    try {
        $sql = '';
        $connection = $this->_resource->getConnection();
        $result = $connection->fetchAll($sql);
        ....
        }
    catch (Exception $e) {
        $this->writeErrorLog($e->getMessage());
    }
}

But I can't not get message of Exception. So that, Anyone show me How to get message of Exception to write log?


texts: Displaying Width, Depth and Height with dropdown for units of measure measurement

texts:
I am new fairly new to Magento, and have been assigned a task which I am having trouble figuring out how to accomplish.

As you can see in the image, Below the product description there is W24 / D28 / H38 and a drop-down for units of measurement.

The Width, height and depth are inserted on per product basis, so each product has their own value for these fields. The units of measurement drop-down contains two values "Centimeters (CM), and Inches (IN)".

When the unit of measurement is changed from CM to IN, the values of Width, Height and Depth are converted accordingly.

So I was wondering if some one can help me and point me the right direction on how i can accomplish something such as this in Magento 1.9 CE?

I think the biggest problem for me is that I have been told to do this using a Widget.. I was told to create a widget to do this.. Is such a functionality even possible using a widget? I have been studying regarding widgets but after creating a few sample widgets to test i felt like this wasn't what i needed to accomplish this? For instance, if i were to create a widget and then maybe create a new Widget Instance from the admin area and set it up to display on products page, but how could this widget collect values for each product?

Any help and/or guidance to the right track to accomplishing my goal will be appreciated.


texts: How to show Hamburger icon on magento2 home page

texts: How to show a hamburger icon  (Mobile toggle navigation menu )in magento 2 home page. Any help would be greatly appreciated.


texts: I am new to amazon web services.And I want to install Magento 1.9.1.1 on it.Can anyone suggest me how to do that?


texts: Magento 2 : Payment Method Restriction Through Event payment_method_is_active in Admin

texts:
I have migrated this piece of code from Magento1 to Magento2.

I am facing problem right now is "Do not know to return the result which we have in array" on admin payment.

Code is:

<?php

namespace Getsquare\AdminPayments\Observer\Payment;

class MethodIsActive implements \Magento\Framework\Event\ObserverInterface
{
    /**
     * Execute observer
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    protected $scopeConfig;

    public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ) {
        $this->scopeConfig = $scopeConfig;
    }

    public function execute(
        \Magento\Framework\Event\Observer $observer
    ) {
        $methodInstance = $observer->getEvent();
        $paymentMethod = $methodInstance->getMethodInstance();
        $config = $this->scopeConfig->getValue('sales/getsquare/adminpayments', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $paymentMethod->getStore());
        if (!$config) {
            return;
        }
        $result = $observer->getResult();
        /*print_r($result);*/
        $adminPayments = explode(',', $config);
        if (in_array($paymentMethod->getCode(), $adminPayments) && false == $result->isAvailable) {
            $result->isAvailable = 1;
        }
    }
}


texts: Magento 2 - How to disable products by custom attribute value?

texts:
In Magento 2, I’m try to disable product by custom attribute value.

For exemple if product has attribute "custom_status" = "disabled" then product is no longer available to customers by any path, product grid, search, url etc.

Do you know how to set this up ?

Thanks


texts: failed to open stream: Permission denied in magento duplicate image removing code

texts:
include('app/Mage.php');
//Mage::App('default');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
error_reporting(E_ALL | E_STRICT);
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
ob_implicit_flush (1);

$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
$_products = Mage::getModel('catalog/product')->getCollection();
$i =0;
$total = count($_products);
$count = 0;
foreach($_products as $_prod)
{
    $_product = Mage::getModel('catalog/product')->load($_prod->getId());
    $_md5_values = array();

    //protected base image
    $base_image = $_product->getImage();
    if($base_image != 'no_selection')
    {
        $filepath =  Mage::getBaseDir('media') .'/catalog/product' . $base_image  ;

        if(file_exists($filepath))
            $_md5_values[] = md5(file_get_contents($filepath));
    }

    $i ++;
    echo "rn processing product $i of $total ";

    // Loop through product images
    $_images = $_product->getMediaGalleryImages();
    if($_images){
        foreach($_images as $_image){
            //protected base image
            if($_image->getFile() == $base_image)
                continue;

            $filepath =  Mage::getBaseDir('media') .'/catalog/product' . $_image->getFile()  ;
            if(file_exists($filepath))
                $md5 = md5(file_get_contents($filepath));
            else
                continue;

            if(in_array($md5, $_md5_values))
            {
                $mediaApi->remove($_product->getId(),  $_image->getFile());
                echo "rn removed duplicate image from ".$_product->getSku();
                $count++;
            } else {
                $_md5_values[] = $md5;
            }

        }
    }

}
echo "rnrn finished removed $count duplicated images";


texts: Magento CE 1.9.3.0 sales_order.info returns no Order Items

texts:
I found out that calling sales_order.info via SOAP in CE 1.9.3.0 does not return Order Items. Instead I only get something array-like:

<items SOAP-ENC:arrayType="ns1:salesOrderItemEntity[1]" xsi:type="ns1:salesOrderItemEntityArray">
    <item xsi:type="ns1:salesOrderItemEntity"/>
</items>

In CE 1.9.2.3 you definitely get all order items back. Is this a bug or how can you retrieve the order items?


texts: Place order button disabled when cart total is 0

texts:
I have enabled zero subtotal checkout in Magento ver. 2.1.5 and now I have a problem with the "Place Order" button being disabled if the value of the cart is $0

If the order value is over $0 in the cart then the button is enabled, I have tested with the default Luma theme and my own custom theme both with the same issue.

It also shows no payment methods on the OPC.

Any ideas?


texts: Magento 2: need to add custom html in admin grid page

texts: is there any way to add custom html in admin grid page.


texts:
I'd like to re-direct all traffic visiting my website (Magento) to an index.html page I have created (this will be temporary for a few days). I guess it would work in much the same way as the maintenance page. Can anyone suggest the best way to do this (limiting the damage to SEO)?

Thank you.


texts:
I created a custom attribute in the ui_components of the cms_pages.  The custom attributes shows up in the admin section, saves to the database and can be seen on the front side of the website.  The name of the attribute is special_page and has a datatype of Boolean.

I now want to create a cms block that will loop through all of the cms pages and return links to pages where the special_page attribute is set to true (1) and the pages is set to active for the particular store.


texts: How to rate products in product listing page?

texts: How to perform rating in any custom product listing page so that user do not have to go to product detail page to rate it? I got suggestions to look at Magento 2 : Show product ratings for each star, average ratings and % of 5 star ratings on product page . This code works to get review. But I need a way so that I can post review  and get it recorded in database.


texts: How to Use Attributes to Narrow Results in Layered Navigation

texts:
Let's say you have multiple attributes with more than one that can apply to multiple products, maybe food.

So maybe I have organic, egg-free, gluten-free, dairy-free, nut-free, etc. Since each product could have an array of these options, using a multi-select attribute seems to make sense. However, since there are thousands of items, this is not practical being that we cannot use the "update attributes" in the actions to mass apply multiple attribute options since not every product has all of the same options in the array.

We also want the filtered results of these attributes to be selective, not additive, so we narrow the results to only the attributes selected in layered navigation. This does not work with multi-select attributes as a default. All products will appear for each selected option.

We would like this to appear as a single "Specialty" attribute or similar in name with the list of available options under it in layered navigation allowing the user to choose multiple options such as dairy-free and organic.

Please make suggestions how this might best be accomplished.


texts:
I was doing that thing in that place when something happened.  What should I do?

(I am using Magento 2.0 and I am receiving these messages that "Something went wrong."  I do not see any stack traces in the log file.  Where is this message coming from, and how do diagnose?)


texts: Magento 2: How to check if Authorization Token is valid

texts:
I am making an mobile app using magento 2 api (Token-based authentication). and I am confused on its expiration. I know that you can set Customer/Admin Token expiration time in Magento Settings. But how do i get that time with an API call?

I am asking this because in most apps user is logged in a shop until he presses logout so i will store this token in my app.

In docs i don't see integration/customer/token returning expiration time and hard coding that value from settings is a bad idea since its value might change. Am i missing something here?

(I could fetch/generate token every time user opens the app but what is the point in expiration then, because that will just generate more tokens for the user that already might logged in).


texts: How to implement Database transaction operations like commit,rollback?

texts:
I want use them like this:

Start Transaction; //What to write here?

    $userModel->setAdmin_id('1')
                    ->setEmail('abc@xyz.com')
                    ->save();

    $profileModel->setProfile_id('1')
                 ->setAccount_name('xyz')
                 ->save();

Commit Transaction; //What to write here?


texts: Use getTemplate() within KnockoutJS foreach

texts:
I get the following error when I try to use getTemplate() within KnockoutJS foreach.

  Message: Unable to process binding "with: function(){return
  getChild('my-child') }" Message: getChild is not defined. getChild is
  not defined

This is how my KOjs template looks...

some markup...

I'm able to render the template outside of the foreach.

I've tried using $parent.getChild but this does not work.

I've also tried this with the more common getRegion method below, but without success:


texts:
I have added java-script in the footer like below and I am passing the customer email dynamically, but the same email id is displaying for all the customers because the page is caching.

Please help me to fix this cache issue.


texts:
I am using Sales_order_place_before event in my module. And the observer returns the error,

User Error: Some transactions have not been committed or rolled back  in C:\xampp\htdocs\cart\lib\Varien\Db\Adapter\Pdo\Mysql.php on line 3937"

config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Observersample_Event>
            <version>0.0.1</version>
        </Observersample_Event>
    </modules>
    <global>
        <models>
            <Observersample_Event>
                <class>Observersample_Event_Model</class>
            </Observersample_Event>
        </models>
        <events>
            <sales_order_place_before>
                <observers>
                    <observersample_event_model_observer>
                        <type>singleton</type>
                        <class>Observersample_Event_Model_Observer</class>
                        <method>example</method>
                    </observersample_event_model_observer>
                </observers>
            </sales_order_place_before>
        </events>
    </global>
</config>

Observer.php:

class Observersample_Event_Model_Observer{

    public function example($observer){
        Mage::log("Order is Placed");
        $order = $observer->getEvent()->getOrder();
        $billing = $order->getBillingAddress();
        $shipping = $order->getShippingAddress();
        $customer = $order->getCustomer();
        Mage::log($billing->getData());
        Mage::log($order->getData());
    }
}

systems.log:

2015-06-12T06:36:26+00:00 DEBUG (7): Order is Placed
2015-06-12T06:36:26+00:00 DEBUG (7): Array
(
)
2015-06-12T06:34:45+00:00 ERR (3): User Error: Some transactions have not been committed or rolled back  in C:\xampp\htdocs\cart\lib\Varien\Db\Adapter\Pdo\Mysql.php on line 3937

I hope someone will help me on this issue.


texts: Clearing Magento sessions folder via SSH because of Inode space - Linux. & Cron Job

texts:
Just wanted some clarification on a question I previously asked.

I'm going to clear my Magento's session folder (.../var/session/).

How many days should I clear it prior to? If I cleared the sessions folder entirely, would it break my Magento store?

Or should I allow around 7 days of session folder lee-way?

I'd be using this code via SSH:

find /public_html/var/session/ -mtime +7 -exec rm {} \;

or

sudo rm -rf /public_html/var/session/

========================================================

As well as this, I dont believe there is a cron-job set up to automatically remove session folder contents, being as the inode space is at 98% because of it. Can anyone point me to a good guide or let me know how I would go about setting one up? Or at least a way to see why it hasnt run, if it has been set up that is

Thanks


texts: Area code not set: Area code must be set before starting a session when UpgradeData

texts:
I'm using magento verison 2.2.5 and i try to use Setup/UpgradeData.php to run a model function to insert data into database from an external API. but when i run php bin/magento setup:upgrade i always got this error:

  Area code not set: Area code must be set before starting a session.

i already set the area code before i run my model function like this:

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class UpgradeData implements UpgradeDataInterface
{
    public function __construct(
      \Vendor\Module\Model\Test $test,
      \Magento\Framework\App\State $state
    ){
      $this->test = $test;
      $this->state = $state;
    }

    /**
     * {@inheritdoc}
     */
    public function upgrade(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $test = $this->test;
        if (version_compare($context->getVersion(), "1.0.3", "<")) {
          $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
          $test->syncBankData();
          $test->syncCUstomerBankData();
        }
    }
}


texts: PHP Fatal error: Call to a member function getCategoryIds() on boolean in

texts: This error is been showing when i am just trying to add product with additional custom option to the product .


texts: magento2.4 accordian with plus minus icon

texts:
I am creating an FAQ page as a CMS page and want to use the native Magento accordian function however I also want each faq to have a plus minus to indicate it can be open/closed.

I know the accordian code is like below:

Title 1

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Title 2

 It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Title 3

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

I found a document about adding a plus minus to a collapsable div but not sure how to use it with the accordion() function?

Initialize the collapsible with the icons option specified:
$("#element").collapsible({ icons: {"header": "plus", "activeHeader": "minus"}});

How to do it ?


texts:
How to get product  Custom Attribute Multiselect Value in order admin magento

app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

After this line

echo $this->getColumnHtml($_item, 'name');

I added My Custom product attribute Value

$_item->getPackaging();//this is multi select value

I am getting here option value like "2245" But i need label like "Bulk"


texts: Magento 2 - How to automatically regenerate sequence tables?

texts:
The situation is: some dude at my workplace migrated the project's database to a new server and somehow, some sequence tables such as sequence_order_xx, sequence_invoice_xx and so on, are missing during the process. After that, he quit the job and I'm the one who take care of the project next.

Because those tables are missing, we can't checkout in all corresponding stores (about 20 stores) with this error message:

Syntax error or access violation: 1103 Incorrect table name '', query was: INSERT INTO `` () VALUES ()

The dude already quit, so I can't check with him to see how the migration process was done. I know that those tables are generated, now they're missing, is there a way to recreate them? I tried reindexing but not working


texts: How to create % discount code for ENTIRE cart subtotal?

texts:
How do I create a discount code for the ENTIRE value of a shopping cart, with multiple items in it?

By default, the "percentage of product price discount" function applies a % discount ONLY to the first line item in your basket. I need to offer the discount on the ENTIRE basket value, even if there are multiple items in it. This discount can be applied to ANY product, there are no category or price restrictions.


texts: Magento 2 : Catalog Product save after Observer Event

texts:
I have a custom multiselect field in Products edit section.

The values in the multiselect values from my custom table. If I click on the save button in Manage Products section by selecting any one value. The changes need to be saved into my table. How can I do it with Observer.


texts: Does anyone have tried to setup Magento 2.1 at UniServer Zero as Local server?


texts:
I have installed a module that allowing to upload attachment to products. But I have to do this pro-grammatically via my other custom module.
installed module have API function in it. But I don't know how to call these API function in Magento-2.

As API file Api/ProductAttachmentRepositoryInterface.php have function -

public function save(Data\ProductAttachmentInterface $productAttachment);

And respective file at location Data/ProductAttachmentInterface.php have following code . That have some variable declaration, get/set function.

`namespace Companyname\ProductAttachment\Api\Data;

interface ProductAttachmentInterface
{
    const ID = 'id';
    const PRODUCT_ID = 'product_id';
    const FILE_PATH = 'file_path';
    const FILE_NAME = 'file_name';
    const FILE_URL = 'file_url';
    const FILE_SIZE = 'file_size';
    const FILE_TYPE = 'file_type';

    const FILE_TYPE_FILE = 'file';
    const FILE_TYPE_URL = 'url';

    const CUSTOMER_GROUP = 'customer_group';
    const STORE_CONFIG = 'store_config';

    const CONTENT = 'content';

    public function getId();

    public function getProductId();

    //public function getFilePath();

    public function getFileName();public function setId($id);
`

Here I am bit confuse.....what I need to pass as parameter and which function I should call and how  ?

Please help me on this...


texts: Magento 1.9.3 Not able to Add or Edit Product

texts:
I am facing an issue after re-indexing not able to add or edit product and old products are not showing.

  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
  error in your SQL syntax; check the manual that corresponds to your
  MariaDB server version for the right syntax to use near ') ) ) AND
  (p.entity_id = '2112') LIMIT 1' at line 3, query was: SELECT DISTINCT
  p.entity_id FROM catalog_product_entity AS p INNER JOIN
  catalog_product_flat_1 AS cpf ON cpf.entity_id = p.entity_id LEFT
  JOIN catalog_category_product AS ccp ON ccp.product_id =
  p.entity_id WHERE ( ( (cpf.attribute_set_id='4' AND ) ) ) AND
  (p.entity_id = '2112') LIMIT 1

AND is 2 times, but it comes from magento core before when i didn't do re-indexing i can do edit and update there is no SQL error but after re-indexing its appears.

I Checked all the necessary things like (Status,Visibility,Qty ,Stock Availability,Product Categories,Indexes and Caches), but i am not able to add or even edit old products, or not able to view on fronted any product on detail page..

  app\code\core\Mage\Rule\Model\Resource\Abstract.php

public function getProductFlatSelect($storeId, $condition)
{
    $select = $this->_getReadAdapter()->select();
    $select->from(
            array('p' => $this->getTable('catalog/product')),
            array(new Zend_Db_Expr('DISTINCT p.entity_id'))
        )
        ->joinInner(
            array('cpf' => $this->getTable('catalog/product_flat') . '_' . $storeId),
            'cpf.entity_id = p.entity_id',
            array()
        )->joinLeft(
            array('ccp' => $this->getTable('catalog/category_product')),
            'ccp.product_id = p.entity_id',
            array()
        );

    $where = $condition->prepareConditionSql();
    if (!empty($where)) {
        $select->where($where);
    }

    return $select;
}


texts: Redirect to checkout from custom observer

texts:
I need to redirect to checkout from an observer related to the event customer_account_edited.

Here is my code. I've deleted a lot of rows that actually works...

Magento is doing everything well but ignore my redirection and send the user to the customer dashboard.

namespace Vendor\Customer\Observer;
use Magento\Customer\Api\CustomerRepositoryInterface;

class CustomerAccountEdited implements \Magento\Framework\Event\ObserverInterface {

protected $customerRepository;
protected $helper;
protected $_objectManager = null;
protected $resultRedirectFactory;

protected $messageManager;

public function __construct(
    \Magento\Framework\App\RequestInterface $request,
    \Magento\Framework\ObjectManagerInterface $objectManager,
    CustomerRepositoryInterface $customerRepository,
    \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory,
    \Magento\Framework\Message\ManagerInterface $messageManager,
    \Vendor\Customer\Helper\Data $helper
){
    $this->_request             = $request;
    $this->customerRepository   = $customerRepository;
    $this->helper               = $helper;
    $this->_objectManager = $objectManager;
    $this->resultRedirectFactory = $resultRedirectFactory;
    $this->messageManager               = $messageManager;

}

public function execute( \Magento\Framework\Event\Observer $observer ){

    $this->messageManager->addSuccess(__("Success message"));
    $resultRedirect = $this->resultRedirectFactory->create();
    $resultRedirect->setPath('checkout/cart');
    return $resultRedirect;

}
}


texts: I am adding my own css it is working only once after that it is not working

texts:
I have added a css through this way

  app/design/frontend/theme/magento_theme/layout
  "default_head_block.xml"

In this <css src="css/own.css"/> i run the command setup:static-content:deploy after that the css is working after that i have added more css into the file but it is not working.

I have deleted the generated folder by run rm -rf *
deleted the pub/static/frontend but at the end my new css is not working.

And i am not understanding why is that so .


texts: Minification is not working even Magento is set to Production mode

texts:
Currently, we are using Magento 2.2.6. I have enabled the Minify and merge js and css via admin panel configuration but the minification is not working.

I have read many posts about the very same issue which I'm facing and done all the suggestions they have given but still not getting the result.

Could anyone please help me with this?


texts: Find value of attribute for each product

texts:
I am trying to find a value of one particular attribute for all products.

Some products have values for this attribute and I can see it here for example:

Where should I look for it in the database to find a product with this attribute's value?


texts: Magento 2 - All configurable products are showing as "not in stock"

texts:
Not sure whats going on. All my configurable products are showing as "not in stock" in the frontend and there is a message saying "Notify me when this product is in stock".
I have set Stores -> Settings: Configuration -> Catalog -> Inventory -> Product Stock Options -> Manage Stock to No but it still shows the message. I also flushed the cache.


texts: Magento 2: Layered navigation $filter->getItemsCount() very slow

texts:
We are using layered navigation and are loading a filter block in sidebar. But $filter->getItemsCount() takes a long time to load.
<?php foreach ($block->getFilters() as $filter): ?>
                    <?php if (!$wrapOptions): ?>
                        <?= $block->escapeHtml(__('Shopping Options')) ?>

                        <?php
                            $wrapOptions = true;
                            endif;
                        ?>
                        <?php if ($filter->getItemsCount()): ?>
                            <?php
                            $title = "";
                            if ($filter->getRequestVar() == "price") {
                                $title = __("Filter"). " ";
                            }
                            $title .= $filter->getName();
                            ?>
                            <?php if ($filter->getRequestVar() == "cat" || $filter->getRequestVar() == "price") { ?>
                                <div data-role="collapsible" class="filter-options-item <?php if($filter->getRequestVar() == "price"){ echo "radioStyle"; } ?>">

<?= $block->escapeHtml(__($title)) ?>

<?= /* @noEscape */ $block->getChildBlock('renderer')->render($filter) ?>

                            <?php } ?>
                        <?php endif; ?>

<?php endforeach; ?>

Can we optimise it further?


texts: Magento 1.9: Best option for managing order from Multi vendor

texts:
I want to build a Multi vendor is like amazon, ebay, flipkart where different sellers upload their products to sell And customer can choose products from different-different sellers. I am not using any 3rd party extension for this like Magento Marketplace Multi Vendor Module.

For managing seller, I provided a panel when they can manage their products and inventory. Also modify customer front-end for showing products through all available seller.

But I am a bit confuse with customer order scenario. The problem is, a customer can choose products from multiple seller means in customer cart i have multiple products from different-different seller. But now when customer place the order i want to notify each seller for placed order with all amounts (product, shipping) as per their store products.

For example we have 2 seller "A-seller" and "B-seller". now a customer select 2 product "Product-1" from seller "A-seller" (product price: $100, shipping: $5) and another product "Product-2" from seller "B-seller" (product price: $150, shipping: $10). And place the order for both product. So the total order amount is $265 ($100 + $5 + $150 + $10). Now i want to notify both seller for that order with their order products total. SO "A-seller" will be notify with $105 ($100 + $5) order amount and also manage separate invoicing and shipping status and "B-seller" will be notify with $160 ($150 + $10) order amount and also manage separate invoicing and shipping status for their product.

Here i have following solutions in my mind -

Solution 1 - Creating split order for both seller via maintaining Seller_Store_Id (display specific order in seller account) with order.

Solution 2 - place single order and creating multiple invoice, multiple shipment based on seller. Showing orders to seller with a layering approach means hide product, price which was not from his store or maybe using invoice data to show the amount.

Can anyone suggest me which one is the best approach or if you have any better idea then let me known?

A bunch of thanks in advance...!!!


texts:
In my other post, I follow steps to be able to pull the Customer Group of a certain customer inside invoice module.

I created this file
app/design/frontend/default/default/template/pdf/statement.phtml

Then in my PDF I edited the HTML and place this one

{{block type='core/template' area='frontend' template='pdf/statement.phtml'}}

Then I have this code

$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
echo $groupId;    // this one returns 0 so it always redirects to ICT
die();
if ($groupId == 10)
{
    echo $this->__('CGD');
} else {
   echo $this->__('ICT');
}

Where did I go wrong. Thanks for the help.


texts: How do I redirect a category page to account page ?

texts:
I want to include the account page in the main menu. So I created a category page. My first try was that I put to the URL Key input the value customer/account, but Magento saved the value as customer-account. After that I tried to do it from URL Rewrite Management, it worked until the first reindexing. I do not want to do it from .htaccess.

Is there another way to do a redirect ? thx


texts:
I face a problem with my magento 2 orders, i've migrated my website from Magento 1.9 to Magento 2.1.7 but there is some magento 1.9 order that i can't open, i've this error "exeption during loading order informations" and this go back to the list of all orders, i've seen some few persons with the same problem but none of their solutions worked for me :/ My new website is live and there is some orders that i can't send because of this problem.

Update: I can see all amazon order from Magento 1.9 but not the order from my website.

If someone know the solution it'll be apreciate to know what i need to do :)


texts: Use Magento’s Core Shopping Cart Model to store/access a list of products

texts: I’m looking for an elegant way to use Magento’s Core Shopping Cart Model to store/access a list of products on a visitor/customer session WITHOUT displaying the products in the basket and WITHOUT modifying magento's core files.


texts: Admin logo magento-icon.svg missing after first install

texts:
Just installed Magento-CE-2.0.4-2016-03-31-10-50-04 and install went fine, but the following file is missing:

www.example.com/pub/static/adminhtml/Magento/backend/en_US/images/magento-icon.svg

In fact, the directory

www.example.com/pub/static/adminhtml/Magento/backend/en_US/images/ is missing (no images directory in en_US).

I selected English (Australian) as my default language at setup, but there is no
www.example.com/pub/static/adminhtml/Magento/backend/en_AU folder.

I guess this issue may be presented to other Magento CE users who select English (Australian) as their default language at setup too.

For a short term fix, I'd like to find an official copy of magento-icon.svg.

Help appreciated.


texts: DDL statements are not allowed in transactions during setup:upgrade in 2.3.5p2 to 2.4.0

texts:
during setup:upgrade get an error

Module 'Magento_PurchaseOrder':
Unable to apply data patch
Magento\PurchaseOrder\Setup\Patch\Data\InitPurchaseOrderSalesSequence
for module Magento_PurchaseOrder.
Original exception message: DDL
statements are not allowed in transactions


texts: How to add extra pricing data in product_data_storage?

texts:
I have added extra price in Advance pricing in Admin.

Everything is working well expect the data for the Recently view products which comes from Local Storage > product_data_storage

How to add that extra price in Local Storage > product_data_storage for the Frontend?

NOTE :

The frontend product repository is a storage service that uses the
local cache to get product information without making additional requests to the server. The product information it provides is useful
for optimal mini-cart, widgets, and checkout customizations.

The product data storage (product_data_storage)

The frontend product repository uses the product_data_storage section
of the data storage cache as its data source. This section is
responsible for holding all product data that come from the server
when a customer visits a product page.


texts: Change URL without losing access to site

texts: I almost finished my magento site. Now I want to edit my base url since I got the standard: http://192.168.2.106/magento/ URL. If I try to change my base URL via backend ->System -> Configuration -> Web - secure/unsecure base-url to for example: http://192.168.2.106/abc/ I'm getting an object not founded! error 404. How can I change my base URL ?


texts: Hide Shipping method from cart page in magento

texts:
I want to hide or remove the Shipping Method from cart page.
The reason to hide is we are giving free delivery on order above 15 pound.
but since magento save the users shipping method in session it show the shipping and handling charge as 3 pound even though the order amount is greater than 15 pound (should be Free delivery).

Or way to unset shipping method from session.

Please refer the image.


texts: How to add rental period attribute in Magento 2?

texts:
RENTING PERIOD:

How to add rental period attribute in Magento 2 ?
So i can add price on Hourly and Daily Rental Period.

There will be product like daily based renting type which are used for days like the vehicle, furniture, and home appliances.

Like

Hire a car for the days you want to and get charged accordingly.
Hire Cloths for the days you want to and get charged accordingly.


texts: Should I run catalog:images:resize on each deployment or only incidentally?

texts:
The question is simple:

Should I add bin/magento catalog:images:resize to our Continuous Integration script, running it on every deployment? Or is it's intent solely to run incidentally (since resized and cached images are also generated upon saving a product)?

Also: does it re-generate all images every time you run it? Or does it detect images that are already resized / cached properly and skips those?


texts: Requisition Lists- How to enable and share out-of-box in Magento 2 Cloud

texts:
Had a question on requisition List. Some users are able to see the requisition list and for some it is hidden. I am aware there is an "enable" configuration for Requisition List at Website level(General -> B2B Features')
Questions:
a) If some users do not see the Req. List, does it mean that the config is disabled for their website or is there some other configuration?
b) If out-of-box, user wants to share his Requisition List with other users in the company, is there such a feature, if yes, how would we do that?
Thanks!


texts: How to check the version of Magento from URL?

texts:
I want to know the programmable logic of getting the magento version by just entering URL of the magento store.Something similar is seen here.

http://magentoversion.com/


texts: Magento 1.9: How to display Telephone on registration form?

texts:
Magento version: 1.9
How to add the telephone field into registration form and make it required?


texts: requested email doesnt match with merchant emails do not match

texts:
I checked the debug file and found that  exception => The requested xoxoxo@gmail.com and configured xoxoxo@mydomain.com merchant emails do not match.

I have a Paypal account with few different email address and G-mail account has been set as a primary account in google.

Is it Ok?


texts:
In my filter.phtml i have this code:

<select name="layered-nav-select" onChange="setLocation(this.value)">
<option selected="selected" value="#">Please Select </option>
<?php foreach ($this->getItems() as $_item): ?>
        <?php if ($_item->getCount() > 0): ?>
            <option value="<?php echo $this->urlEscape($_item->getUrl()) ?>">
                <?php
                echo $_item->getLabel();
                if ($this->shouldDisplayProductCount()):
                    echo '(' . $_item->getCount() . ')';
                endif;
                ?>
            </option>
        <?php else: ?>
            <option value="#">
                <?php
                echo $_item->getLabel();
                if ($this->shouldDisplayProductCount()):
                    echo '(' . $_item->getCount() . ')';
                endif;
                ?>
            </option>
        <?php endif; ?>
<?php endforeach ?>

code is working correctly see link: http://prntscr.com/b2ibsg

But I need the Filter name instead of Please Select , for example in first filter instead Please select - display Manufacturer name,

Thanks


texts: How do you get grouped product associated items to show in the search results page?

texts:
I would like to quickly preview names of all the associated items- similar to this:

Trying edit the list.phtml file but everything I do makes the entire search result body disappear...


texts: Magento 1.9.x SOAP API V2 own attribute for category not transferred

texts:
I want to extend the SOAP API for the category with own attributes.

The first attribute is a simple text-value that should be stored in the database.
The second attribute should be used to upload the category-image. Later it will be a complexType but for testing it is a simple string-element (like the first attribute). I want to transport the image-data with this attribute, save the physical image file in the update/create-function and set the attribute "thumbnail" in the category-object. So I don't need to store the second attribute in the database.

For this I've created a new extension with an install-script to create the first attribute. I've also created the file wsi.xml to insert both attributes in the WSDL for SOAP and extended Mage_Catalog_Model_Category_Api_V2 to manipulate the update-action for my needs. This works already. Both attributes are displayed in the WSDL.

This is how I've added the attributes in wsi.xml:

        ...
        <xsd:complexType name="catalogCategoryEntityCreate">
            <xsd:sequence>
                <xsd:element name="my_attribute_1" type="xsd:string" minOccurs="0" />
                <xsd:element name="my_attribute_2" type="xsd:string" minOccurs="0" />
            </xsd:sequence>
        </xsd:complexType>
        ...

Now when I run catalogCategoryUpdate() I can set the first attribute (that I have inserted with my own extension and the install-script) and the value will be stored.

Now the problem: It seems that the second attribute (that I only need in the API) is not transferred to my update-function. When I dump the variable $categoryData into a logfile (to see whats in it) I can see that the second attribute is not there. I think magento removes this attribute because I haven't defined it in the install script.

The question: How can I define an own attribute in the SOAP-API to use it in the update-function but without create it in the database?

EDIT: I've edited my problem-description because I've found out the following things:

I've tested the script with the soap-call for catalogCategoryInfo() on different locations to see if my own attributes will be returned or not. This is the resut:

Call script on the server with the magento-project: my own attributes are missing
Call script on my local server (XAMPP): returns the data with my own attributes
Call script on an other server: returns the data with my own attributes

At this morning I've called the script on my local server so my first attribute was there. Then I swiched to test on the server with the magento-project and there it didn't worked anymore (I thought only the second attribute didn't worked but it were both...)

SO THE QUESTION IS:
How can the server where the script with the soap-call is placed influence the returned values? Which server-configuration has this effect?


texts: magento 2 : Call on click function custom module template file

texts:
I want to call on click function in template file with script type "text/x-magento-init".

Then please tell me how can i do this?


texts: core/html_select set aria-selected Magento 1

texts:
I'm searching for a solution with the magento buildin way to create html select blocks, with aria-required.
I can display basic attributes like the id or the class for example, but not this attribute.

Here is my first essay:

$select = Mage::app()->getLayout()->createBlock('core/html_select');
$select->setName($name)
       ->setClass($class)
       ->setId($id);
       ->setArialRequired($ariaRequired); //doesn't work

Here is my second essay:

$select = Mage::app()->getLayout()->createBlock('core/html_select');
$select->setData(array(
    'name' => $name,
        'class' => $class,
        'id' => $id,
        'aria-required' => $ariaRequired //doesn't work
    ));


texts: Magento 2.1.7 Open Source. No system configuration

texts:
I have just installed an empty copy of Magento 2.1.7 using Installatron to a sub folder of my website (mysite.com/store) where mysite.com is a Joomla CMS.

I am trying to set up so the entire front end uses https, and found a guide that said to navigate to: System -> Configuration -> General -> Web -> Redirect options

I can go to the admin panel using the mysite.com/store/[randomcharacters] and log in, but when I do there are no system configuration settings:

I can't find anywhere that says there is a separate "system" admin panel, so not sure what I am doing wrong.

Thanks.


texts: How to force flush CSS cache on client side?

texts:
Suppose that we changed a lot of functionality for the module (templates, layouts, CSS) and we are going to move these changes to the production site, but a lot of customers have cached CSS in their browsers. So here is a question. How to force flush client's CSS cache and avoid file renaming (styles.css -> styles-v2.css). There is one logical way but it doesn't work in Magento, because it checks file existing (by the way this method works for JS files), see below:

<action method="addCss">
    <stylesheet>css/styles.css?1</stylesheet>
</action>

Any ideas?


texts: Magento 2.2.1- Fullscreen image close button not working iOS

texts:
When I click on the close icon on an iphone or ipad nothing happens. Hooked the device up to my iMac to debug and there's no errors in the console. Any suggestions?

Update

As highlighted below this was an issue with the fotorama plugin and fix is currently on the 2.2-develop branch. https://github.com/magento/magento2/pull/13268


texts: How to check if a category with a certain ID exists?

texts:
How can I check in a template file if a category with a certain ID exists, eg. ID 270.

I have tried the following but the statement is echoed even though there is no category 270. I'm not really sure what else to try... thanks very much for any help!

$category = new Mage_Catalog_Model_Category();

if ($category->load(270)) {
    echo "Category found";
}


texts: Magento2: How to implement simple Ajax demo for Product Collection?

texts:
I want to display product using ajax method on button click same page.

How is it possible in Magento?