texts: Magento 1.9: Create a City dropdown, problem with ajax

texts:
I have a problem with my code ,I follow This question but i still get 404 Not Found

i will put my files and please I need help:
file config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <Zeo_Citydropdown>
      <active>true</active>
      <codePool>local</codePool>
      <version>0.1.0</version>
    </Zeo_Citydropdown>
  </modules>
</config>

File app/code/local/Zeo/Citydropdown/etc/config.xml:

<?xml version="1.0"?>
<config>
  <modules>
    <Zeo_Citydropdown>
      <version>0.1.0</version>
    </Zeo_Citydropdown>
  </modules>
  <global>
    <helpers>
      <citydropdown>
        <class>Zeo_Citydropdown_IndexController</class>
      </citydropdown>
    </helpers>
  </global>
    <!-- start of routers -->
  <frontend>
    <routers>
        <citydropdown>
            <use>standard</use>
            <args>
                <module>Zeo_Citydropdown</module>
                <frontName>citydropdown</frontName>
            </args>
        </citydropdown>
    </routers>
  </frontend>
</config>

File app/code/local/Zeo/controllers/IndexController.php:

<?php
class Zeo_Citydropdown_IndexController extends Mage_Core_Controller_Front_Action{

    public function getCitiesAction($selectedCity = '',$stateId){
        $result=array();
        $result['mycities']=Mage::helper('citydropdown')->getCitiesAsDropdown($selectedCity,$stateId);
        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
    }
}

File app/design/frontend/cleo/default/opc/onePage/billing.phtml:

<script type="text/javascript">
 <?php
  $address         = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
  //$defaultCity     = $address->getCity();
 ?>
 Event.observe($('billing:country_id'), 'change', function(event) {
  var defaultCity  = '';
  if ($('billing:country_id').value == 'PS') {
    var defaultCity  = 'Ramallah';
  }
  if ($('billing:country_id').value == 'AE') {
    var defaultCity  = 'Abu Dhabi';
  }
  var selectCountry  =  $('billing:country_id').value;

  var action   = "/index.php/citydropdown/index/getCities/" + selectCountry + "/" + defaultCity;
  if(selectCountry == "AE"){
   var stateId  =  $('billing:country_id').value;
   var request  =  new Ajax.Request(action,
         {
          method: 'GET',
          onSuccess: function (data) {
                /* add this code */
                var myjson=data.responseText.evalJSON(true);

                $('billing:city').replace('<select id="billing:city" name="billing[city]" class="required-entry">' + '<option value=""></option>' + myjson.mycities + '</select>');
            },
          onFailure: '',
         }
        );

  } else if(selectCountry == "PS"){
   var stateId  =  $('billing:country_id').value;
   var request  =  new Ajax.Request(action,
         {
          method: 'GET',
          onSuccess: function (data) {
                /* add this code */
                var myjson=data.responseText.evalJSON(true);

                $('billing:city').replace('<select id="billing:city" name="billing[city]" class="required-entry">' + '<option value=""></option>' + myjson.mycities + '</select>');
            },
          onFailure: '',
         }
        );

  }
 });
 Event.observe($('billing:country_id'), 'change', function(event) {
  var selectCountry  =  $('billing:country_id').value;;
  var defaultCity  = '<?php echo  $defaultCity ?>';
  if(selectCountry != "US"){
   $('billing:city').replace('<input type="text" class=" input-text required-entry absolute-advice " title="City" value="' + defaultCity + '" id="billing:city" name="billing[city]" autocomplete="off">');
  }
 });
</script>


texts: Possible to have multiple websites, some with shared customers, some with separate customers?

texts:
I want to know if it is possible to have three websites, two of which would share the same shared set of customers, and the third would have an entirely different set of customers.

Can you let me know if this is possible, perhaps if there was a plugin that could allow this?

Or perhaps an alternative technique? Perhaps we set it up with separated customers on each website, and hourly, we sync customers between two of the websites?


texts: Problems with saving CMS page changes in Magento-1.9.2.1

texts:
I have some problems that I hope you can provide advice.
I newly installed Magento 1.9.2.1 and noticed strange behavior when i save something.

From the Navigation bar,  I enter the the default 'about us' CMS page,and when I try to change the contents by copy and paste html data from my original site via the wysiwyg editor , and then click 'save and continue', I get at 403 error and the changes cannot be saved.
I tried to create product data and when I try to make changes to specifically the description of product data by copy and pasting it with html tags and then click 'save and continue', The changes cannot be saved and there is not even any error message displayed.

There are no third party module being installed.

Please advise on how I can resolve the problem. Thank you very much.


texts:
I have a lot of SKU's and a lot of SKU's share some pictures.

For eg -  Product A, B and C have 2 common photos. When I upload the common photos through the panel, It uploads the same image to the server again and again by adding _1 in the file name.

Also tried using bulk upload but get errors. I don't want this duplicating of photos as I have a lot of SKU's and photos and my server won't be able to handle all that data.

Is there any solution to this?


texts:
After having some issues with 8788 patch. I cant seem to revert 8788v1. So I was wondering if the following was possible based on

Revert SUPEE-8788 v1/

The process that I have followed using version control is to copy the patch into the root directory. Run the Patch. Then once it has been installed remove the patch file from the root directory. Then merge and commit etc. So how do I then revert this patch? I have tried placing the same file again in the root directory and running sh patch-file-name.sh -R But I am given a lot of errors and it does not revert the patch.

I also have a question I updated a site to 1.9.2.4 but I have installed v2 of the 8788 patch but Mage Report is saying that it is not patched. Could I simply install patch 3941 as 1533 is not installed and 8788 v1 is not installed Would this work?

How do I do this:

Revert SUPEE-8788 v1/
Revert SUPEE-1533 (if installed)

Because the patch files are not in the root of the Magento website.

Also if I have installed 8788v1 and installed 3941 and cant revert 8788v1 can I just install 8788v2?

The other issue is that it says to install 3941 but it is only available for versions 1.8 - 1.9 so if the site is greater than 1.9.0.1 or lower than 1.8 do I install it?

Thanks


texts:
I want after I have pasted sku or name product into the input seach, it will automatically check and notify. I am currently using autoComplete jQuery. But the problem is that if it doesn't show drop down, pressing enter will not work.

  Example: scan barcodes -> auto-complete sku -> automatically select
  products


texts: Magento 2: Get discount price after rule applied

texts: Magento 2 get the discount price after rule applied. i.e I have different rules applied on cart. how can I find which rule give how much discount on subtotal. Currently, I can find the discount amount of item from the quote. but I want to find a discount amount after only one rule instead of all the rules. I have tried this $item->getDiscountAmount() but this gives the discount price after all rules applied;


texts: Unable to post product reviews on secondary store site; displays recaptcha error but no recaptcha is present in form?

texts:
In Magento 1.9.2.4, the product review form has no recaptcha, but won't post with the error:

The reCAPTCHA wasn't entered correctly.

Those are the only two instances of "recaptcha" in the page source.

How can I go about resolving this issue? I'm just learning Magento.

The POST to http://second.first.com/second/review/product/post/id/4802/ returns status code 302 Moved Temporarily.

By the way we have url-key product URL rewrites like http://second.first.com/second/product-url-key-value.html.

We did recently get an SSL cert. so I resent the request to https://... and got 302 Found, but the recaptcha error persists.

We do have reCAPTCHA enabled in the default config under Customer Configuration > CAPTCHA, and functioning on our main/primary store/site "first.com". It posts to the same URL structure, sans https, successfully. I tried disabling it for the secondary site in particular but that didn't help, not surprisingly, as Review isn't even listed as an option for the forms to apply to. So I really haven't the slightest idea how this is happening.


texts: ReadyShipper on OS X, Connecting to HTTPS SOAP Endpoint

texts:
This is a long shot, but has anyone here gotten Ready Shipper 7.3 working with a Magento SOAP HTTPS (that's S, as in secure) endpoint?  If so, how?

That is, I've downloaded the ReadyShipper 7.3 desktop client for OS X.  I can connect this desktop client to local Magento servers running over HTTP.  However, if I try to connect to an HTTPS endpoint, the UI says my credentials are invalid.

I know my credentials are correct.  I can make connections to this SOAP endpoint using PHP's SOAP client, and do so from my local machine to a remote endpoint, so I know the problem isn't networking related.

When I check ReadyShipper's logs, I see the following added when the application attempts to connect to my SOAP endpoint

javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

My assumption is there's something in ReadyShipper's HTTPS connecting code that prevents it from working.  I've added logging to Magento's  index.php bootstrap (which routes all requests), and nothing is logged when the ReadyShipper application should be requesting the SOAP WSDL, and making a SOAP request.  (this logging works for non-secure HTTP endpoints)

Short of turning off HTTPS (which is a non-starter) is there anything I can do on my end (i.e. I control the Magento server, not the application) to fix this?

(yes, I'm escalating with vendor support -- just covering my bases here)


texts:
Having setup Magento 2, after looking at response headers and the page itself i think that any page is not cacheable without a lot of work.
I am not a Magento developer just a guy that was requested to look into Varnish and Magento 2.

On the teams live projects i see the responce cookie of PHPSESSID as well as Magento form key on every single page.
On client requests there is always the PHPSESSID as well.
Each Page has the anonymous users cart.
On my clean Magento 2 i can also see that Pragma and Cache-Control do not allow caching of any page.

I have downloaded and read the whole Varnish Book, as well as doing all the exercises. So i do understand how Varnish basics work, as well as caching in general.

Even on a clean Magento2 with the default VCL for Varnish 4, every page is getting a MISS or Hit-for-Pass.

All Magento caches are enabled and full_page is configured to use Varnish.
Sessions are stored on redis, webserver is Nginx and php-fpm7 for php code execution.

It's just feels strange because Magento and all people that post Tutorials and How To's claim that this should work fine just by setting it up(like fpc used to work).

I am looking into running Magenx's amazing setup script in case they have already made the needed changes somewhere but i doubt this will be the case.

Using Curl on the teams project(without varnish) on the landing page this is the response:

 HTTP/1.1 200 OK
Server: nginx
Date: Fri, 02 Mar 2018 16:33:26 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Trace: 2BCC3FA5AEE05BC675A023867155A0D3180B410BAF9A6B7D4ABF57BB2101
Set-Cookie: store=default; expires=Sat, 02-Mar-2019 16:33:20 GMT; Max-Age=31536000; path=/; HttpOnly
Set-Cookie: PHPSESSID=xxxxxxxxxx; expires=Fri, 02-Mar-2018 19:20:00 GMT; Max-Age=10000; path=/; domain=xxxxxxxxx; HttpOnly
Pragma: no-cache
Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Expires: Thu, 02 Mar 2017 16:33:20 GMT
X-Magento-Debug: 1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

Curl on the clean project(Note i made it work with some tweeking on the vcl that like /pub/check_health -> /check_health)

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 02 Mar 2018 16:24:39 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Trace: 2BF11055A47A22D473F72419BD995CCC259228308C7C5011137B1003AC01
Set-Cookie: store=default; expires=Sat, 02-Mar-2019 16:24:39 GMT; Max-Age=31536000; path=/; HttpOnly
Set-Cookie: PHPSESSID=xxxxxx; expires=Fri, 02-Mar-2018 17:24:39 GMT; Max-Age=3600; path=/; domain=xxxxxxxx; HttpOnly
Pragma: cache
Cache-Control: max-age=86400, public, s-maxage=86400
Expires: Sat, 03 Mar 2018 16:24:39 GMT
X-Magento-Tags: store,cms_b,cms_p_2,cat_p
X-Magento-Debug: 1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

So the clean Magento was my messup.
But how can we handle the First one?The clean one has No Cache-control headers while the first one throws the VCL into this block:

   if (beresp.ttl <= 0s ||
       beresp.http.Surrogate-control ~ "no-store" ||
       (!beresp.http.Surrogate-Control &&
       beresp.http.Cache-Control ~ "no-cache|no-store") ||
       beresp.http.Vary == "*") {
       # Mark as Hit-For-Pass for the next 2 minutes
        set beresp.ttl = 120s;
        set beresp.uncacheable = true;
        set beresp.http.X-CantCache = true;
    }


texts: hide a form attribute for a specific role in magento 2

texts:
in my case i want to hide an attribute's form for a specific role of users for example the role is = 'userrole1', this is the form attribute :

            My Attribute

<input class="admin__control-text" type="text" data-bind="
        event: {change: userChanges},
        value: value,
        hasFocus: focused,
        valueUpdate: valueUpdate,
        attr: {
            name: inputName,
            placeholder: placeholder,
            'aria-describedby': noticeId,
            id: uid,
            disabled: disabled,
            maxlength: 255
    }" name="customer[zd_user_id]" aria-describedby="notice-SKUB9DT" id="SKUB9DT" maxlength="255">

so I want to hide this  for just the role 'userrole1'.

Is there anything I can do to Handel with this ?


texts: Magento 1.9.2.1- Performance Suddenly Decreased

texts:
I inherited a project from a work colleage about a year ago now. It's a Magento 1.9.2.1 store (heavily customised) and after reviewing areas of code, I almost had a heart attack.

Up until the beginning of February the site has been running fast without any issues. However the site has suddenly slowed up. Page load times have gone from 1-2 seconds to 7-11 seconds.

No code or updates have been made to the store, which makes me think it could be a database issue. However, I have checked all of the culprit tables (log tables truncated and optimised, Core URL rewrites at a stable amount), but no joy.

This is happening on all pages across the site, category, home and product pages.

I have resorted to creating a copy of the site and turning on the profiler (first time using this). Looking through the output of the profiler it seems the speed decrease is coming from the following areas in the profile tree:

mage    8.6182
mage::dispatch::routers_match   8.5354
mage::dispatch::controller::action::catalog_category_view: 8.5129
layout/db_update: default   8.4524
layout/db_update: MAP_popup 8.4476
layout/db_update: SHORTCUT_popup    8.4465
layout/db_update: SHORTCUT_uk_popup 8.4452
layout/db_update: catalog_category_layered  8.4444
layout/db_update: CATEGORY_260  8.4434
layout/db_update: customer_logged_out   8.4423
mage::dispatch::controller::action::catalog_category_view::layout_render    8.3916

All caches are turned on, but yet after the initial load of a page, any subsequent load is still just as slow.

Can anybody point me in the right direction as I have come to a dead end.

The admin area is still quick and nippy.


texts: Magento 2.3.1 add custom attribute to customer

texts:
I have follow several guide or tutorial but I can't understand how insert a custom attribute to customer general info, specifically I would to insert a second email field.

Actually I've the following structure

src/app/code/
|-- Vendor_Name
|   |-- CustomerAttribute
|   |   |-- registration.php
|   |   |-- etc
|   |   |   |-- module.xml
|   |   |   |-- extension_attributes.xml
|   |   |   |-- Setup
|   |   |   |   |-- Patch
|   |   |   |   |   |-- Data
|   |   |   |   |   |   | -- AddCustomerAccountCode.php

AddCustomerAccountCode.php contains the following code

<?php

namespace Vendor\CustomerAttribute\Setup\Patch\Data;

use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Customer\Setup\Patch\Data\UpdateIdentifierCustomerAttributesVisibility;

class AddCustomerAccountCode implements DataPatchInterface
{
    private $moduleDataSetup;

    private $customerSetupFactory;

    public function __construct(
        ModuleDataSetupInterface $moduleDataSetup,
        CustomerSetupFactory $customerSetupFactory
    ) {
        $this->moduleDataSetup = $moduleDataSetup;
        $this->customerSetupFactory = $customerSetupFactory;
    }

    public function apply()
    {
        $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
        $customerSetup->addAttribute(Customer::ENTITY, 'email_agent', [
            'type' => 'varchar',
            'label' => 'Email Agente',
            'input' => 'text',
            'sort_order' => 100,
            'position' => 100,
            'required' => false,
            'visible' => true,
            'system' => false
        ]);
        $customerAccountCode =$customerSetup->getEavConfig()->clear()
            ->getAttribute(Customer::ENTITY, 'email_agent');

        if ($customerAccountCode->getAttributeId()) {
            $usedInForms =  ['adminhtml_customer','customer_account_create'];
            $data = [];
            foreach ($usedInForms as $formCode) {
                $data[] = ['form_code' => $formCode, 'attribute_id' => $customerAccountCode->getAttributeId()];
            }
            $this->moduleDataSetup->getConnection()->insertMultiple(
                $this->moduleDataSetup->getTable('customer_form_attribute'),
                $data
            );
            $this->moduleDataSetup->getConnection()->endSetup();
        }
     }
    /**
     * {@inheritdoc}
     */
    public static function getDependencies()
    {
        return [
            UpdateIdentifierCustomerAttributesVisibility::class,
        ];
    }

    public function getAliases()
    {
        return [];
    }
}

File module.xml into etc folder has these lines

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="VendoName_CustomerAttribute" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Customer"/>
        </sequence>
    </module>
</config>

Where is the trick?

Thanks


texts: Is it possible to have two product view page in magento

texts:
please help me to trigger out this issue. I am new in magento and hence really need your help.

I need to have two product view pages in magento. One for local products and another for international products. I have customized the default product view page in order to display local products.International product view page will be displayed, when I clicked on 'international product' link, which i had provided in the default product view page. I have created a fully functional module with name 'international' for international product. But now I am in utter confusion.

How can I make my custom module which should exactly function like the default product view page? Is it the proper way to make another product view page? Please provide me with your suggestions on this issue. Guide me properly.


texts: how to translate data in hindi and other local language

texts:
I want to translate english to other indian languages like punjabi, marathi and more.I have created an module. In which Getiing product collection. once I reacieved the data in english I can translate into into india laguages. Array I recieved in english I want to convert all the element of array in hindi and rest of content, Like CMS pages contnet, Order Content Etc.

Product collection

Controller file of Extension

public function chnageslang(){

             $Option = Mage::getResourceModel('catalog/product_option_collection')->addFieldToSelect('product_id');
            $Option->getSelect()->group('main_table.product_id');
            $entityIds = new Zend_Db_Expr($Option->getSelect()->__toString());

            if (!empty($n_collection['collection'])) {
                $prod[$h]['type'] = $this->__('New Arrival');
                $prod[$h]['type_id'] = 'new';
                $newcollection = $this->collectionDetail($n_collection['collection']);
                $prod[$h]['product'] = $newcollection ? $newcollection : array();
                ++$h;
            } else {
                $prod[$h]['type'] = $this->__('New Product');
                $prod[$h]['type_id'] = 'new';
                $prod[$h]['product'] = array();
                ++$h;
            }

}


texts: Magento 2 - Can't compile theme in production mode anymore | Unable to retrieve deployment version of static files from the file system

texts:
I get this error when trying to execute grunt refresh or grunt exec:all.
[2020-08-17 05:25:31] report.CRITICAL: Can not load static content version. [] []
[2020-08-17 05:25:31] report.ERROR: Unable to retrieve deployment version of static files from the file system.
#0 vendor/magento/framework/App/View/Deployment/Version.php(67): Magento\Framework\App\View\Deployment\Version->readValue('production')
#1 vendor/magento/module-theme/Model/Url/Plugin/Signature.php(87): Magento\Framework\App\View\Deployment\Version->getValue()
#2 vendor/magento/module-theme/Model/Url/Plugin/Signature.php(65): Magento\Theme\Model\Url\Plugin\Signature->renderUrlSignature()
#3 vendor/magento/framework/Interception/Interceptor.php(146): Magento\Theme\Model\Url\Plugin\Signature->afterGetBaseUrl(Object(Magento\Store\Model\Store\Interceptor), 'https://relaunc...', 'static', $
#4 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Store\Model\Store\Interceptor->Magento\Framework\Interception\{closure}('static', false)
#5 generated/code/Magento/Store/Model/Store/Interceptor.php(143): Magento\Store\Model\Store\Interceptor->___callPlugins('getBaseUrl', Array, Array)
#6 vendor/magento/framework/Url.php(482): Magento\Store\Model\Store\Interceptor->getBaseUrl('static', false)
#7 vendor/magento/framework/View/Asset/Repository.php(284): Magento\Framework\Url->getBaseUrl(Array)
#8 vendor/magento/framework/View/Asset/Repository.php(233): Magento\Framework\View\Asset\Repository->getFallbackContext('static', NULL, 'frontend', 'company/fresh', 'de_DE')
#9 vendor/magento/module-developer/Console/Command/SourceThemeDeployCommand.php(172): Magento\Framework\View\Asset\Repository->createAsset('css/styles-m.le...', Array)
#10 vendor/symfony/console/Command/Command.php(255): Magento\Developer\Console\Command\SourceThemeDeployCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Con$
#11 vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output$
#12 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Developer\Console\Command\SourceThemeDeployCommand\Interceptor->___callParent('run', Array)
#13 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Developer\Console\Command\SourceThemeDeployCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Componen$
#14 generated/code/Magento/Developer/Console/Command/SourceThemeDeployCommand/Interceptor.php(104): Magento\Developer\Console\Command\SourceThemeDeployCommand\Interceptor->___callPlugins('run', Array,$
#15 vendor/symfony/console/Application.php(1000): Magento\Developer\Console\Command\SourceThemeDeployCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Componen$
#16 vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Developer\Console\Command\SourceThemeDeployCommand\Interceptor), Object(Symfony\Comp$
#17 vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput$
#18 vendor/symfony/console/Application.php(147): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 bin/magento(23): Symfony\Component\Console\Application->run()
#20 {main} [] []

My store is set to production mode my root directory is set to /pub. The problem appeared suddenly, before it always worked.
How can I solve it, without setting my store to development mode?
I noticed that the file pub/static/deployed_version.txt was missing, so I executed php bin/magento setup:static-content:deploy -f, then the file was created. Then I executed grunt exec:all again. But then the error shows and the file gets deleted again.


texts: Magento 2 : Assign related products to sku

texts:
I am using below script to assign related sku to main sku.
Script works well but the only issue is it removes old sku & assign new set of sku.
I want to know if their is any way we can just assign new sku & keep existing one's ?
$obj = \Magento\Framework\App\ObjectManager::getInstance();

        /** @var \Magento\Catalog\Model\Product $product */
        $productObject = $obj->get('Magento\Catalog\Model\Product');

        $product = $productObject->loadByAttribute('sku', 'Test Test');

        $linkDataAll = [];
        $skuLinks = "0012365,test1233,789456";
        $skuLinks = explode(",",$skuLinks);

        foreach($skuLinks as $skuLink) {
            //check first that the product exist
            $linkedProduct = $productObject->loadByAttribute("sku",$skuLink);
            if($linkedProduct) {
                /** @var  \Magento\Catalog\Api\Data\ProductLinkInterface $productLinks */
                $productLinks = $obj->create('Magento\Catalog\Api\Data\ProductLinkInterface');
                $linkData = $productLinks //Magento\Catalog\Api\Data\ProductLinkInterface
                    ->setSku($product->getSku())
                    ->setLinkedProductSku($skuLink)
                    ->setLinkType("related");
                $linkDataAll[] = $linkData;
            }

        }
        if($linkDataAll) {
            print(count($linkDataAll)); //gives 3
            $product->setProductLinks($linkDataAll);
        }
        $product->save();


texts: send custom product price to checkout on add to cart in magento2

texts: I have a custom price in phtml which is shown in the product page.Now I want to send that price to checkout page on add to cart click in magento2 that custom price is coming in js variable and input text field name. If anyone knows reply to me.


texts: Products having associated crossell products should be removed if the main product is removed in magento2.1.7

texts:
Products having associated crossell products should also be removed if i remove the main products in magento2.1.7 see my screenshot below..

Here the flower is the main product(ie,simple product) and the teddy bear is its associated crossell product..if i remove the flower its associated crossell product ie, teddybear should also be removed automatically..plz someone guide me on this where to apply the logic


texts: magento 2 order confirmation email sending before payment gatway redirection

texts:
I am new to magento2 and developing a custom payment module for ccavenue.I am facing a problem regarding order confirmation email.

The order confirmation email is sending once the customer redirecting to payment gateway page and order is creating with pending status.I want to send this email after a successful transaction.

Here is my payment js code

define(
[
    'jquery',
    'Magento_Checkout/js/view/payment/default',
    'Magento_Checkout/js/action/place-order',
    'Magento_Checkout/js/action/select-payment-method',
    'Magento_Customer/js/model/customer',
    'Magento_Checkout/js/checkout-data',
    'Magento_Checkout/js/model/payment/additional-validators',
    'mage/url',
],
function (
    $,
    Component,
    placeOrderAction,
    selectPaymentMethodAction,
    customer,
    checkoutData,
    additionalValidators,
    url) {

        return Component.extend({
            defaults: {
                template: 'Magekmf_Ccavenue/payment/ccavenue'
            },
            placeOrder: function (data, event) {
                if (event) {
                    event.preventDefault();
                }
                var self = this,
                    placeOrder,
                    emailValidationResult = customer.isLoggedIn(),
                    loginFormSelector = 'form[data-role=email-with-possible-login]';
                if (!customer.isLoggedIn()) {
                    $(loginFormSelector).validation();
                    emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());
                }
                if (emailValidationResult && this.validate() && additionalValidators.validate()) {
                    this.isPlaceOrderActionAllowed(false);
                    placeOrder = placeOrderAction(this.getData(), true, this.messageContainer);

                    $.when(placeOrder).fail(function () {
                        self.isPlaceOrderActionAllowed(true);
                    }).done(this.afterPlaceOrder.bind(this));
                    return true;
                }
                return false;
            },

            selectPaymentMethod: function() {
                selectPaymentMethodAction(this.getData());
                checkoutData.setSelectedPaymentMethod(this.item.method);
                return true;
            },

            afterPlaceOrder: function () {
                window.location.replace(url.build('ccavenue/request'));
            },
            /** Returns send check to info */
            getMailingAddress: function() {
                return window.checkoutConfig.payment.checkmo.mailingAddress;
            }

        });
    }
);


texts: Ajax call not working on Magento_Wishlist

texts:
I have created a controller for products added wishlist or not, if available include class name,
Controller:
<?php

namespace Vendor\Mymodule\Controller\Index;

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

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Wishlist\Helper\Data $wishlistHelper,
        \Magento\Framework\Controller\Result\JsonFactory $jsonFactory
        ) {
            parent::__construct($context);
            $this->wishlistHelper = $wishlistHelper;
            $this->jsonFactory = $jsonFactory;
    }

    public function execute() {
        $result = $this->jsonFactory->create();
        $data = $this->wishlistHelper->getWishlistItemCollection()->getData();

        return $result->setData(['status' => 200, 'items' => $data]);
    }
}

The controller working, i want to include class using ajax
Path: app\design\frontend\Zero\my_theme\Magento_Wishlist\templates\catalog\product\list\addto\wishlist.phtml
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist $block */
?>
<?php if ($block->getWishlistHelper()->isAllow()) : ?>
    <div class="product-id-<?php echo $block->getProduct()->getId();?>">

    <a href="#"
       class="action towishlist"
       title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"
       aria-label="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>"
       data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($block->getProduct()) ?>'
       data-action="add-to-wishlist"
       role="button">
       <img class="whislist-icon" src="<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/whislist.png'); ?>" />
        <?= $block->escapeHtml(__('Add to Wish List')) ?>

<?php endif; ?>

The script not functioning, the class not included, how to included that, my condition if products added to the wishlist should include class ,
<div class="product-id-<?php echo $block->getProduct()->getId();?>">


texts: Transport Exception : Content-Length mismatch Installing Magento 2.3.6

texts:
I have to install the magento 2.3.6 on my vagrant VM it actually already working on other VMs but today I have created another VM and start installing the magento2 but got this weird error at some point when it start downloading the base/magento2.3.6
Downloading (10%)
Downloading (10%)

  [Composer\Downloader\TransportException]
  Content-Length mismatch, received 4447103 bytes out of the expected 40360494

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

Tried with the allow_url_fopen On it is not still working getting the same error.
Is there any work around to fix this issue?
Any help will be appreciated:
Thanks and Regards,


texts: After saving product on frontend, search results disappear

texts:
I have an observer that watches the event: catalog_block_product_list_collection

When this event triggers my code iterates through the collection, finds the SKU for a certain product, then changes the price and saves.

Here's the code:

<?php

public function changePrices(Varien_Event_Observer $observer){
    $collection = $observer->getEvent()->getCollection();

    foreach ($collection as $product){
        if ($product->getData('is_api')){

            $parts = new SoapClient("XXXX");
            try{
                $res = $parts->ExactPartLookup([
                    'userName' => 'XXXX',
                    'password' => 'XXXX',
                    'partNumber' => $product->getData('sku'),
                    'make' => $product->getAttributeText('manufacturer_code')
                    ]);
                $price = $res->ExactPartLookupResult->PartInformation_v2->List;
                Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
                $product->setMinimalPrice($price);
                $product->setPrice($price);
                $product->setFinalPrice($price);
                $product->save();
            }
            catch(SoapFault $e){
                Mage::log($e->getMessage(), null, 'errortest.log');
            }
        }
    }

}

I'm getting a weird issue when I place a search in my store. The first time I search something, it will show results. However when I refresh that search results page, it will not display any results. If I search for another keyword, it will show results, and then I can search the original keyword again and it will show results.

Here's a video illustrating what's actually happening:
http://recordit.co/IRnwqbhYUy

I've now introduced the same code into the AdminHtml product grid.
When I set the price on the api products, the products that don't fall within that criteria have an empty string for price. I'm thinking that this is a related issue.


texts: Get product attribute on product list in one query

texts:
I figure this part of a code is getting all products for product page

$collection = Mage::getResourceModel('catalog/product_collection')
        ->setStoreId($this->getStoreId())
        ->addCategoryFilter($this);

I need to get available colors only for each product on product list page. So for example if my configurable product consists of 3 simple products with colors: red, green, blue, but simple product with color green is disabled, product with color red is out of stock, how do I show only color "blue".

I would like to do it in single query so it doesn't waste my resources. Is it possible to do some joins on default collection to get that data?

Here is the example of loading few products and under each product's image I would like to show available color.


texts: Magento2.3 Undefined index: list_id in Stores/Save.php

texts:
I installed a Mailchimp integration plugin on our magento2.3 website and it does not seem to load the configuration page . When I look in the exception.log I get the below error
Undefined index: list_id in /vendor/mailchimp/mc-magento2/Controller/Adminhtml/Stores/Save.php on line 95

I am not sure how to fix this. I have tried reinstalling the plugin but that brings me to the same place.


texts:
I have just met a curious trouble. When I log to my live store admin panel and go to System>Backups, there is not any backups listed available while there are several backups in the var/backups directory when I connect to the SFTP. Even the panel display is strange...
My Filezilla Screenshot with backup files on the var/bacups directory :

The Backups section from the admin panel of my local development store (eveything is OK):

The Backups section from the admin panel of my live store (nothing is OK):
Everything was fine until two days ago when the backups listing disapeared...I only work on a local version of my store, not on the live one so nothing has been changed on my live store.
Any clue of what happens and how to correct that bug ?
Thank you !


texts:
I'm unable to get the theme id (althought I have the theme)
use Magento\Framework\View\Design\Theme\ListInterface;

/**
 * @var ListInterface
 */
private $themes;

public function __construct(ListInterface $themes){
    $this->themes = $themes;
}

private function getTheme($theme_needle){
    foreach ($this->themes as $theme){
        /** @var Theme $theme */
        $themeTitle = $theme->getThemeTitle(); //this return the good value
        if($themeTitle == $theme_needle){
            //var_dump($theme->getThemeId()); this return null
            //var_dump($theme->getCode()); this return the good value
            return $theme->getId(); // this return null
        }
    }
    return null;
}

theme database content

EDIT : This will do the trick but I can't figure out what is wrong with the other one method
            $select = $conn->select()
                ->from(
                  ['t' => 'theme'],
                  ['theme_id']
                )
                ->where(
                    't.theme_title=?',$theme_needle
                );
            $theme_id = $conn->fetchOne($select);


texts: Adding tabs to custom view in Magento's admin section

texts:
I have tried to follow a couple of tutorials and when that failed tried to copy an example in the magento core to add tabs to a custom admin module, but with no success. Looking at the tutorials and the code the magento I feel I am close but can't work out what I am missing to achieve my desired results.

What I have is a displays for users that fall into set groups. I would like to add a couple of tabs to the left of that grid to allow the end user more options.

So far I have got this:

layout/prefs.xml

<layout version="0.1.0">
<prefs_adminhtml_adminprefs_index>
    <reference name="content">
        <block type="prefs/adminhtml_edit_tabs" name="admin.tabs" >
            <block type="prefs/adminhtml_prefs" name="adminprefs" />
        </block>
    </reference>
</prefs_adminhtml_adminprefs_index>
</layout>

.

class Ps_Prefs_Block_Adminhtml_Prefs
extends Mage_Adminhtml_Block_Widget_Grid_Container
{
public function _construct()
{
    $this->_controller = 'adminhtml_prefs';
    $this->_blockGroup = 'prefs';
    $this->_headerText = $this->__('Preference centre users');//title
    $this->_addButtonLabel = $this->__('Add Item');
    parent::_construct();
}

protected function _prepareLayout()
{
    $this->setChild( 'grid',
            $this->getLayout()->createBlock( $this->_blockGroup . '/' . $this->_controller . '_grid',
            $this->_controller . '.grid')->setSaveParametersInSession(TRUE) );
    return parent::_prepareLayout();
}
}

.

class Ps_Prefs_Block_Adminhtml_Prefs_Grid
extends Mage_Adminhtml_Block_Widget_Grid
{
public function _construct()
{
    parent::_construct();
    $this->setId('prefs_adminprefs_index');
    $this->setDefaultSort('email');
    $this->setDefaultDir('ASC');
    $this->setSaveParametersInSession(TRUE);
    $this->setUseAjax(TRUE);
}

protected function _prepareCollection()
{
    $collection = Mage::getModel('prefs/prefs')->getCollection();
    $this->setCollection($collection);
    return parent::_prepareCollection();
}

protected function _prepareColumns()
{
    $this->addColumn('prefcentre_id', array(
        'header'    =>  $this->__('ID'),
        'align'     => 'left',
        'width'     => '50px',
        'index'     => 'prefcentre_id',
    ));

    ......MORE COLUMNS......

    $this->addColumn('subscribed', array(
        'header'    =>  $this->__('Subscribed'),
        'align'     => 'left',
        'width'     => '80px',
        'index'     => 'Subscribed',
        'type'      => 'options',
        'options'   => array(
            0 => 'Subscribed',
            1 => 'Not Subscribed',
        ),
    ));

    return parent::_prepareColumns();
}

public function getRowUrl($row)
{
    return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}

public function getGridUrl()
{
    return $this->getUrl('*/*/grid', array('_current'=>true));
}
}

.

class Ps_Prefs_Block_Adminhtml_Prefs_Edit_Tabs
extends Mage_Adminhtml_Block_Widget_Tabs
{
public function __construct()
{
    parent::__construct();
    $this->setId('prefs_tabs');
    $this->setDestElementId('prefs_edit_form');
    $this->setTitle($this->__('News Information'));
}

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

    $this->addTab('Signed up', array(
        'label'     => $this->__('User Information'),
        'title'     => $this->__('A User'),
        'content'   => $this->getLayout()->createBlock('prefs/adminhtml_prefs_edit_tab_form')->toHtml()
    ));

    $this->addTab('Newsletter options', array(
        'label'     => $this->__('Newsletter options'),
        'title'     => $this->__('Checkboxes'),
        'content'   => $this->__('some text to show its working')
    ));
}
}

The way I understood the tutorials was that this last file would get called and because of my layout file the grid would be rendered within those tabs. Why is this not working?


texts:
I am in a Digital Ocean Ubuntu droplet trying to toggle development mode in my Magento installation so that I can develop a theme.

My problem is I can't figure out how to run magento deploy:mode:set developer

I gather I have to make the magento command global.

Well I tried: export PATH=/var/www/html/example.com/public_html/bin:$PATH

and that did not work.

If I type magento into the terminal it says Command Not Found.

Please assist.


texts: Magento2: How to remove product images programmatically?

texts:
During edit product from front-end I need to remove images of the product
gallery which are checked by the user to remove it.


texts: hide radio button under checkout payment method

texts:
we are using 5 Payment methods with payment methods codes are "code1, code2 , code3, code4 and code5".

for site purpose we are using code1 , code2, code3 payment methods.

we have mobile app for our site, for that purpose,

we are using code4 , code5 payment methods.

So code4 and code5 payment methods should not display in site. so i removed those payment methods name. but code4 and code5 payment methods RADIO BUTTONS are still displaying in the site.

in methods.phtml i used this script to remove those radio buttons

foreach ($methods as $_method):
$_code = $_method->getCode();
if($_code == 'innobyte_payu_lite_cc' or $_code == 'cashondelivery'{continue;} //this line
?>

but those Radio buttons are not hiding. If we disabled the payment method code "code3" than those radio buttons will hide. but we want the payment method code3 in our site.

How to hide those radio buttons with payment method code3 enabled in site.


texts: What is alternative for cacheable="false"?

texts:
If I used cacheable="false"in my custom module layout file then I get customer id by using when all type of cache is enabled.

public function _construct(
    \Magento\Customer\Model\Session $session
) {
    $this->customerSession = $session;
}
public function abc()
{
    if ($this->customerSession->isLoggedIn()) {
        echo $this->customerSession->getCustomerId();
    }
}

But when I upload module in the marketplace then it rejected because of cacheable="false" so what is alternative way of cacheable="false"to get customer id in the frontend.


texts: Magento2 upgrading to 2.3 causes inventory issue

texts:
I am facing issue in inventory items prior to Magento upgrade.

So, on firing the command bin/magento inventory:reservation:list-inconsistencies
 there are list of product with following msg.

Inconsistencies found on following entries:

  Order 000004514:
    - Product XXX should be compensated by -2.000000 for stock 1

How to solve this issue?


texts: Get e-mail domain for admin in Magento 1.9 website

texts:
Lets say I have two magento websites, the first one is www.magento-test.com and the second one is www.magentotest.com. And lets say the e-mail for admin user for the first one is john.doe@magento.com and for the second one is john.doe@magentotest.com.

Is there a possible to get the e-mail domain? For example, for the first one I want @magento.com and for the second one I want @magentotest.com.


texts: Unable to display Product with its description in home page of rwd theme?

texts:
I am trying to display a product with its description on the home page

It only allows to display price and name?

How to display some description with it?

I use {{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="5" template="catalog/product/list.phtml"}} in cms-> homepage. Which display only product name and price.

I need to display description of product with it.


texts: Magento 1.9.2.4 very slow loading speed after new theme installed

texts:
I've installed a new theme, Porto, on my magento store and now my website is loading slower than a snail moves :(

I've done all the steps just as the documentation is saying and now... :(

I've tried to flush the cache but it didn't help.

They ask for the compiler to be disabled so i disabled it

Here is the full theme documentation:

http://www.portotheme.com/magento/porto/documentation/

Can anybody please help me? X_X thank you! :D


texts: There is a problem that only No is returned even if Yes / No is set for Catalog Input Type for Store Owner in Attribute Properties

texts:
The selectable products and simplified products were saved with Yes.

No was output when acquiring the corresponding attribute code on the front end.

The following is the code written when getting the attribute value.

$child->getResource()->getAttribute('request_to_purchase')->getFrontend()->getValue($child);

My environment is as follows.

Magento 2.2.6
PHP 7.1

I do not know the cause.

please tell me.

Properties

Storefront Properties


texts:
It possibile to fix this issue?
Where is the file that i can minify?
How can i find it?
Thanks :)

Magento 2.2.2 CE


texts: Intermittent 'Cannot create an empty shipment.' when bulk processing shipments

texts:
We have an intermittent 'Cannot create an empty shipment.' when bulk processing shipments. Used the API before.

This controller is triggered with bulk selected orders in order overview. It ships all items per order and sends the e-mail.

Somehow we get 'Cannot create an empty shipment.' .... $itemQty > 0 just checked

Are we forgetting anything?

public function _shipmailinvoice($email=true) {

    $orderIds = $this->getRequest()->getPost('order_ids', array());

    $cnt_Orders     = count($orderIds);
    $cnt_Shipments  = 0;
    $cnt_Invoices   = 0;

    if (!empty($orderIds)) {
      foreach ($orderIds as $orderId) {
        $order = Mage::getModel('sales/order')->load($orderId);
        //$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);

        $itemQty = (int)$order->getItemsCollection()->count();
        $shipment = $order->prepareShipment($itemQty);
        //$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
        if ($shipment && ($order->hasShipments() < 1)) {
            $shipment->register();
            $order->setIsInProcess(true);
            $order->addStatusHistoryComment('Shipment created by SNH_SHipMailInvoice.', false);
            try {
                $transactionSave = Mage::getModel('core/resource_transaction')
                ->addObject($shipment)
                ->addObject($shipment->getOrder())
                ->save();
                if ($email) { $shipment->sendEmail($email, '')->setEmailSent(true)->save(); }
                $cnt_Shipments++;
            } catch (Mage_Core_Exception $e) {
                // var_dump($e);
                $this->_getSession()->addError($e, 'Cannot create shipment');
            }
        } else {
            if ($email) { $shipment->sendEmail($email, '')->setEmailSent(true)->save(); }
            $cnt_Shipments++;
        }`


texts: Previous customers name showing in cached static block

texts:
I wanted to build a static block in Magento where when a customer logs in they see there name with a welcome message (dependant on name length), however it appears on implementation that the previous logged in customers details are being stored, yet i have static block cache turned off.

<?php $customer = Mage::getSingleton('customer/session')->getCustomer();
    $firstName = $customer->getFirstname();

    if(strlen($firstName) > 10 ) {
        echo "Hey $firstName!";
    } else {
        echo "Hey there!";
    }
?>

I have loaded this into my theme file by declaring it as a static block

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

And created a static block in Magento with the following:

{{block type="core/template" cache_lifetime="null" name="customname" template="customname/customname.phtml"}}

Can anyone advise why this could be caching?

Thanks


texts: I want to import csv file into multiple tables in magento 2.4.please advice

texts: I am new to magento. I want to import csv file into multiple tables. I created a import.xml, CustomImport.php, RowValidatorInterface.php. After that i created a module, and registraion.php. Even though i am not getting the solution. Please guide me.


texts:
How to add computed value into the field:

        $fieldset->addField(
        'percentage',
        'text',
        array(
            'label'  => Mage::helper('edpa_adpan')->__('Drop/Rise %'),
            'name'   => 'percentage',
            'value'  => .....,
  //the function which calculate the difference between two fields is working in Grid perfectly, just don't know how to add this computed value to the field

        )
    );


texts: Warning: include(Varien/Object.php): failed to open stream: No such file or directory in /-/-l/lib/Varien/Autoload.php on line 94

texts:
after a year I had logged on to my backend to tweak some data,
after tweaking, i had cleared the cache thru the dashboard, untill then website and data responding was working fine, today i am trying to log in to backend and the frontend, both are displaying the below error..

Warning: include(Varien/Object.php): failed to open stream: No such file or directory in /home/graciasb/public_html/lib/Varien/Autoload.php on line 94
Warning: include(Varien/Object.php): failed to open stream: No such file or directory in /home/graciasb/public_html/lib/Varien/Autoload.php on line 94
Warning: include(): Failed opening 'Varien/Object.php' for inclusion (include_path='/home/graciasb/public_html/app/code/local:/home/graciasb/public_html/app/code/community:/home/graciasb/public_html/app/code/core:/home/graciasb/public_html/lib:.:/usr/lib/php:/usr/local/lib/php') in /home/graciasb/public_html/lib/Varien/Autoload.php on line 94
Fatal error: Class 'Varien_Object' not found in /home/graciasb/public_html/app/code/core/Mage/Core/Model/Config/Options.php on line 35

i have manually deleted the content from var/cache folder, but no help, its still the same,,
please help


texts:
I would want to know which permissions i must set in the Magento2 setup and after the install.

Special mention in var/generations, that at the end i must put it in 777 or I'll never can install it.


texts: Showing error of unserialize when run upgrade command in Magento2.2.3


texts: Most efficient way to get data in templates

texts:
I've created a small template in which I need access to information such as the currency code, cart total etc.

I'm able to get them with the methods below, but which is the most efficient?  Is there a better way?

METHOD 1

$_store = Mage::app()->getStore();
$_currencyRate = $_store->getCurrentCurrencyRate();
$_currencyCode = $_store->getCurrentCurrencyCode();
$_currencySymbol = Mage::app()->getLocale()->currency($_currencyCode)->getSymbol();
$_cartTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();

METHOD 2

$_currencyRate = Mage::app()->getStore()->getCurrentCurrencyRate();
$_currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
$_currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
$_cartTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();


texts: How To Apply Custom Shipping Tax Amount in Magento2

texts:
We need to apply a custom shipping tax rate to the shipping amount. Present i configured flat 12% tax on shipping prices but i need to take highest tax percentage from all the products in cart/checkout and needs to apply it.

For example in my cart page i have two products which is under following tax rules.

Product A - 5% tax

Product B - 12% tax

In this case i need to take 12% tax and added it to the shipping amount. How can i proceed on this?


texts:
Is it possible to create a custom form element that can be used in widget instance creation?

Fields used in widgets is setup using widget.xml ,for example:

        <my_field>
            <label>My Field</label>
            <type>textarea</type>
        </my_field>

How can i replace textarea with a completely custom form element ?


texts: modification "order review" in own theme doesn't work only in magesetup directory (1.9.0.1 CE)

texts:
I maybe have  a problem / found an error. I want to modify the order review for german markets, to display product images in order review. As far as I know:

Modify:

/app/design/frontend/default/my_theme/template/checkout/onepage/review/
info/item/totals.phtml

That doesn't work! Nor does

/app/design/frontend/base/default/template/checkout/onepage/review/...

Changing info and totals does have an effect, but: Only changing the following file, has an effect on modification:

/app/design/frontend/base/default/template/magesetup/checkout/onepage/review/item.phtml

Has anybody an explanation? Is there anaother way or did I miss something?


texts: Magento 2: How to set cron for reindex in SSH in magento 2?

texts:
I want to know how to set cron for reindexing a particular indexer method in Magento 2. I have used below code to reindex all but not working:

* * * * * php –f /shell/indexer.php reindexall

Can somebody help?


texts: Block Magento Site from specific countries

texts: How can I block specific countries accessing Magento 2 site?


texts: Registration on Success Page in Magento2

texts: I want to add the possibility to ask the guest customer to create an account on the success page in Magento2, after the order has been received in magento just like this.


texts: Magento 2 product list page pagination not working

texts:
I am using Magento 2.1.5 and and on category listing page i have 48 products but its default display 12 products but not showing the pagination.
how to solve it ?

default value for product is set 12 per page. Has any one have this issue?


texts: Use the same javascript file in both areas

texts:
I have JS component which I want to use in both areas: frontend and adminhtml.

Don't want to duplicate the same file for my module in two locations: view/frontend/web/js/custom.js and view/adminhtml/web/js/custom.js

Is it possible to place JS in some "global" location, or is there a way to load frontend resource in adminhtml area?


texts: Show all categories and sub category name in sidebar on product listing page

texts: I'm using a custom theme in Magento 2. How can I display listing of categories and sub categories in the side bar of a product listing page.


texts:
I am creating a new module for inquiry submission. After form is submitted my control comes on my post controller under my index sub-folder inside controller folder.

I want to achieve two things in my post controller.
 1. Save data to database [Achieved]
 2. Send an email [Not getting the right way to do it]

I am using below code for sending email.

        $transport = $this->_transportBuilder->setTemplateIdentifier('hello_template')
                    ->setTemplateOptions($templateOptions)
                    ->setTemplateVars($templateVars)
                    ->setFrom($from)
                    ->addTo($to)
                    ->getTransport();

        $transport->sendMessage();

But transportBuilder is not working for me. Please help me with below things

Which class should I extend in my controller?
How to write my constructor so that it can manage dependencies?


texts: Magento2 - error when selecting dom elements on cms pages

texts:
I am working with an independent js file that I instantiate in an xD module and if I launch a console.log ("test") it appears in the console without problem, then a basic example of logic comes that I want to do, if It fulfills the condition that it is in url / page, I select an element of the dom and change the background.

As we see, the dom element always gives me null, and if I go to the browser and assign it, it works for me, what am I doing wrong?


texts:
So first and foremost excuse me if this has been asked before, but there are so many questions regarding not working js translations that I didnt find any matching mine.

I had an issue where I wanted to dynamically translate the result of an API undercertain circumstances in JS like this:

value['availability'] = $.mage.__(value['availability']);

But no matter what I did the value wouldnt be translated, while it would if I used the static text instead of variable aka:

value['availability'] = $.mage.__('Ask Us');

After a bit of debugging I came to this situation:

// $.mage.__('Ask Us');
value['availability'] = $.mage.__(value['availability']);

Which then magically worked, so I came to the following conclusion, something in the generation of js-translation.json seems to check wether or not the csv translations actually appear in js files.

After a bit more grumbling I came to the thought that possibly this is the case to prevent a huge file beeing loaded client side everytime a user opens the page, so actually expected behaviour.

But now is the issue if thats expected behaviour, whats the expected solution for dynamic translations, because I dont think its to rare that someone wants to translate the returns of an AJAX call, for example translating error msgs.

But putting every possibilty of a dynamic translation in a comment above is probably not the intended way to go, so I was wondering what is?


texts:
I'm having a problem with the catalog_eav_attribute table of magento database.
Some columns are hidden but if i click on each rows i can see them.
I've tried a lot of solution proposed in other posts like copying the table to another db and then restore it, delete the database and restore the backup.

Thanks in advance for the help.

Magento version: 2.1.7


texts: How to add option in display mode of display setting in category in admin panel?

texts:
There are three options (1. products only, 2. Static block only, 3. Static block and products) in display mode, i want add two more options so can any one help me  to add more options.

thanks in advanced.


texts: Magento 2: Verify email address with Third-party API

texts:
I have to validate the email address before adding into the website for the below areas. Verification will be by some API like
https://www.zerobounce.net/docs/email-validation-api-quickstart/

Register
Newsletter subscribe
Checkout

Also, need to get from where this email address is added, for example, Registration form, Checkout, Newsletter form, etc
Please give me some suggestions regarding this.


texts: Magento 2 : How to implement Travis CLI in my custom module?

texts:
I've some modules to Magento 2.0 and 2.1, so I'd like to implement the Travis CLI to install the Magento and test my extension in some Magento versions and PHP versions, how can I do that?

Thanks


texts:
As Magento2 is using RequireJS for loading scripts, and there's no more skin folder, I've stuck with a problem:

How can I replace Magento's module JS file by my modified version?

For example — the opc-checkout-method.js which belongs to Magento_Checkout extension. It's not defined in the requirejs-config.js file, as far as I can see.

My extension is loaded after Magento_Checkout, so its requirejs-config.js data is appended at the end of resulting requirejs-config file.

Or should I do it in some other way, without replacing the whole script?


texts: Uncaught (in promise) ReferenceError: object is not defined on checkout page

texts:
JS object is not defined on the checkout page.

Already included the script on the checkout page. Exactly the same thing is working on a simple Html page. but creating some issue on magento2.


texts:
I'm sending data from my Magento 2 store into a GTM in order to track several aspects of the store.
Everything was working just fine and all the required data was being sent ok, but for some unknown reason the data for one specific store is no longer being sent. (this is a 4 websites each one with more than one store).
I've attached 2 pics, one shows the datalayer working and the other one simple dont work.
Can someone please help me ?

Regards


texts: Can we login+logout Magento admin programmatically by PHP script only

texts:
Can we login+logout Magento admin by simple PHP code which presents outside Magento setup. I need this functionality because my requirement only full fills by this scenario only.

mywebsite.com/magentosetup (Magento setup here)
mywebsite.com/hitme.php (I need a custom script here for login and logout)

How can I do this with PHP+magento code customization?

For logout, I find this example link but this code does not work for me.

I checked the code in Indexcontroller of Magento for logout function here only these lines are present.

$adminSession = Mage::getSingleton('admin/session');
$adminSession->unsetAll();
$adminSession->getCookie()->delete($adminSession->getSessionName());
$adminSession->addSuccess(Mage::helper('adminhtml')->__('You have logged out.'));
$this->_redirect('*');

But this line of code is not working externally for logout externally. When echo this line in Magento section

$adminSession->getSessionName()

it provides "adminhtml" but the same line externally PHP file it provides "PHPSESSID". Let me know what can I do for login and logout admin programmatically.


texts: Ajax quantity Increment Decrement button plus-minus symbols not showing

texts:
I install Ajax Quantity  Cart Update  Increment Decrement extension on https://marketplace.magento.com/rltsquare-ajax-shopping-cart-update.html
Ajax quantity Increment Decrement extension plus-minus buttons are working, but not showing  -/+ symbols

https://prnt.sc/qq3bvk

Anyone help how to solve this  problem


texts: Disable sending order email programmaticaly

texts:
For some reason, I'm splitting my order in two part (the first is handle by some organization and the other will me handle by the magento owner).

I'm creating programmatically the order, and for one of the part, I need to stop the mail of the order to be sended.

Example :
In quote : watch, Tv, video game.
Splitting in two parts :

watch, tv
video games

Send email for the watch and tvs
Not send mail for video game.

How can I do this ?

EDIT : i'm splitting my code by doing a foreach on the quote item. If the item is in a category, I create a array with those items.

Then I'm creating my order like this : https://www.rakeshjesadiya.com/how-to-create-order-programmatically-in-magento-2/

And i'm calling the method twice, one for the first part, the other for the second.

I've notice that the email is not sended for the second part if I have placed those 2 orders parts. That's ok I guess, but if the first part is not placed, the second part will send a mail.


texts: Magento 2 - while saving product from admin getting error as Class Magento\ConfigurableProduct\Model\Product\VariationHandler does not exist

texts:
Magento 2 while saving product from admin getting error as "Class Magento\ConfigurableProduct\Model\Product\VariationHandler does not exist". But this class is there in Vendor folder.

There is no use even after clearing generation files and re-compiling the code.


texts: covert Text field to drop down selection

texts:
HI I downloaded an extension (checkout-custom-form) from here, I want to modify his extension,
https://github.com/sbodak/magento2-checkout-custom-form
the extension itself work wonderful.
having below XML code and it will display as a text box, how do I convert into dropdown selection box?
restaurant, government, education, retailer ...etc
  <item name="checkout_industry" xsi:type="array">
 <item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
     <item name="config" xsi:type="array">
     <item name="customScope" xsi:type="string">customCheckoutForm</item>
     <item name="template" xsi:type="string">ui/form/field</item>
     <item name="elementTmpl" xsi:type="string">ui/form/element/textarea</item>
     <item name="cols" xsi:type="string">15</item>
     <item name="rows" xsi:type="string">2</item>
  </item>
      <item name="provider" xsi:type="string">checkoutProvider</item>
      <item name="dataScope" xsi:type="string">customCheckoutForm.checkout_industry</item>
      <item name="label" xsi:type="string">Industry</item>
      <item name="sortOrder" xsi:type="string">5</item>
</item>

custom_field.phtml
    <?php
/** @var Bodak\CheckoutCustomForm\Block\Order\CustomFields $block */

/** @var Bodak\CheckoutCustomForm\Model\Data\CustomFields $customFields */
$customFields = $block->getCustomFields($block->getOrder());
?>
<?php if($customFields): ?>

                <?php /* @escapeNotVerified */ echo __('Other information') ?>

                <?php /* @escapeNotVerified */ echo __('Industry') ?>

                    <?php echo nl2br($this->escapeHtml($customFields->getCheckoutIndustry())); ?>

<?php endif; ?>


texts: Getting weird error in system.log after fresh installation of Magento CE 1.7.0.2 related to GeoIP

texts:
After a fresh installation of Magento CE 1.7.0.2, I am getting a 404 Page not found on localhost/index.php and localhost/index.php/admin. I enabled debugging in index.php and I am getting the following log over and over (every time I refresh the page):

2014-08-01T14:49:38+00:00 DEBUG (7): GEOIP::COUNTRY::APPFR

2014-08-01T14:49:38+00:00 DEBUG (7): GEOIP::CONTINENT::APPEU

Notice the "APP" before the "FR" (for France)? I have no idea how I am getting this error.

By the way, i installed the GeoIP extension after I built a Ubuntu 14.0.2 VM with LAMP installation (PHP 5.5.9 and MySQL 5.5.38). The weird thing is the GeoIP extension didn't come with PHP5.5, I had to install it separately (apt-get install php5-geoip) in order to be able to install the database through Magento Installation Wizard.

Thanks


texts: setting language to website in magento 2.0.2

texts:
I need an italian language site but now is only in english.
I tried to change my default language but my site is always in english language.

My change was this:
Stores -> Configuration -> In the "Store View:" label, I selected my StoreView.
Then I went in: General -> General and set up "Italiano (Italia)" unchecking the "Use Website" checkbox.

I downloaded the file from this site (zipped xml italian files) and copied into my server:
https://crowdin.com/project/magento-2/it#

I have read this link
http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-i18n.html
In my server there is not this folder: "/app/i18n/"
Am I obliged to make the language package ?


texts: Defer JS / CSS Magento 2 via layout files?

texts:
After reading a lot of devdocs, I can see there is a case for deferring in CSS and JS in the manual

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-types.html#layout-types-conf

However, I can not seem to get this method to work. I'm either placing the files in the wrong location, naming them incorrectly, or just not using the correct syntax as none is provided in the docs.

I've tried placing different methods inside app/design/frontend/theme/name/Magento_Theme/layout/default_head_blocks.xml but I've had no luck, other than removing some of the CSS, as described in

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/xml-instructions.html

I don't seem to be able to remove any JS via the default_head_blocks.xml nor implement the defer to any CSS or JS. And to be honest, the directions in the docs are confusing and many of the examples, don't include the features. Or the directory structure doesn't exist. My Magento theme files are all inside /vendor/magento/ and not in /app/design/ - I am using a cloned copy of Luma where I changed the registration and other files to be able to use it as a renamed theme, but the XML layout instructions are not very well done.

If anyone knows what syntax to use to defer CSS or JS in the header, it would be greatly appreciated as ever method I've tried seems to have no effect.


texts: There are no commands defined in the "indexer" namespace. php 7.2 (ubuntu)

texts:
When i want to re Index in Magento2 in php version of 7.3,
this display me this error
An exception was raised while creating "Request"; no instance returned
And when i change to version 7.2
Display this Error.....

Also i use this command with my root Directory (same error)
So how can i simply use Indexer command in Magento2
I thing something too wrong with my Magento :(
Also check this image :--

My all commands are not working.
Also i change my Magento Folder Permissions


texts: Magento 2 - Rest API add new custom request for home page slider

texts:
I have a table, where I am storing data for home page slider. (home_slider)
I have also created a module for updating slider from backend.

Now I want to add a custom API request in existing Magento rest API to fetch active sliders for mobile APP.

If you don't want to share code then it's ok, please guide me the path how can I achieve this?


texts: Magento 1.9 - Product qty auto canceled in new received order and also order status cancel but payment done?

texts: Nowadays order received with qty canceled and also order status canceled but the payment is done in payment gateway panel. What is the issue for this?


texts: I want to know how we can get product attribute option ID based on product attribute option value using REST API.


texts:
I have set up a custom template and all working fine apart from KO templating is not working in the custom theme so things lick the checkoutpage is not rendering.

I have the following set:
- One page checkout
- User does not have to be registered
- parent theme Magento/blank

However, things that use the KO rendering template (like estimated shipping and checkout).

Any ideas?


texts: Magento2 Configure varnish-6.4.0 in magento2.3.2

texts:
How to config varnish-6.4.0 in Magento2.3.2?
I need to install varnish cache in my system, but the version of varnish cache installed is varnish-6.4.0. How can I Config it?


texts: How to create custom variable programatically for template in magento 2

texts:
With the all searching so far I have found that we can add custom variable using this:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$model = $objectManager->get('Magento\Variable\Model\Variable')->loadByCode('custom-variable-code');
$plain_value = $model->getPlainValue();

but I have no idea where to add this and what to do with plain value.
Please let me know how can I create custom variable which I can use in my email template globally. Thanks


texts: Country dropdown options are not sorted ASC

texts:
I've created a new installation with Magento 1.9.4.1 for a client of mine. But here is the problem, all the country dropdown options are not sorted ASC. For example, if I choose a country on the checkout page this will show all the countries but not in correct order.

eg:
Taiwan
Belgium
United States
Angora

I hope someone is able to help me with this question, thank you in advance :).

Best regards,
Myron


texts:
when paying with the card, sometimes it works well and returns a success message, but then sometimes on the second third try it returns an error message and money is cut off anyway...(mail is not sent after that because it works on success only.
what May I check?
asked bank which api we use and they say payment is correct.
debug log says
[2020-09-18 07:28:35] main.INFO: TBC Auth Request {"request":{"command":"v","description":"firefox-3-2000000097","currency":"981","msg_type":"SMS","language":"GE","client_ip_addr":"162.158.210.153","amount":1}} []
[2020-09-18 07:28:36] main.INFO: TBC Auth Response {"response":"TRANSACTION_ID: KZ7nK1sKgVwB18CNPDKMc3K9cLA="} []
[2020-09-18 07:28:57] main.INFO: Post value {"postValue":"{\"trans_id\":\"KZ7nK1sKgVwB18CNPDKMc3K9cLA=\",\"Ucaf_Cardholder_Confirm\":\"0\"}"} []
[2020-09-18 07:28:57] main.INFO: trans_id {"trans_id":"KZ7nK1sKgVwB18CNPDKMc3K9cLA=","encoded":"KZ7nK1sKgVwB18CNPDKMc3K9cLA%3D"} []
[2020-09-18 07:28:58] main.INFO: Payment response/status {"response":"RESULT: FAILED
RESULT_CODE: 908
3DSECURE: NOTPARTICIPATED
RRN: 026207208959
APPROVAL_CODE: 200169
CARD_NUMBER: 4***********8987","status":200,"trans_id":"KZ7nK1sKgVwB18CNPDKMc3K9cLA="} []
[2020-09-18 07:28:58] main.INFO: Payment failed or has been cancelled [] []


texts: Can Anyone explain in details that how magento2 cache working?

texts:
Actually i have modified one file from cache directly in magento2

  pub/static/_cache/merged/528a5a59b09a5ecbef1a.min.css

After that i have run all the commands setup:upgrade

setup:static-content:deploy and cache:flush and cache:clean

still my changes remaining on server.

Can you please tell me how all the caches working?


texts:
I want to Programmatically create Custom Product Attributes in Magento 2.3.3 and I want a Unit/Quantifier in this input field as well like

lbs in this example.
Its code is

            lbs

Any help is highly appreciated.


texts: How to set a rule for buying two products together to reduce the total price?

texts:
I am trying to make a block which shows two products in it with a rule that if a customer bought these two products together the total amount will be reduce by some extent.

e.g. if product A is of $100 and B is of $75, then both will be buy together for $150.

Can anyone has an idea how to apply these kind of promotion rules in magento. I really need to do this as the client need this kind of functionality on its product view page.

I want something like this.


texts: My scenario is to give a bag if a customer purchases a product. But customer will not be known only warehouse workers will be insisted to give bag for the product. I'm having a order export functionality to export daily orders to warehouse. In that sheet I have to show bag as new line to appropriate product. I have to add a product to order which should not show in cart or orders and anywhere. Any suggestion would be helpful.


texts: Magento 2 “Area code not set” warning in Observer from module

texts:
I get "Area code not set error" when my observer executes. What can I do?

Code:

<?php

namespace MyCompany\MyModule\Observer;

use Magento\Framework\Event\ObserverInterface;
use \Magento\Framework\App\Bootstrap;

class SaveOrder implements ObserverInterface
{
    private $logger;
    private $state;

    public function __construct(
        \Magento\Framework\View\Element\Context $context,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\App\State $state
    ) {
        $this->_layout = $context->getLayout();
        $this->_request = $context->getRequest();
        $this->logger = $logger;
        $this->_state = $state;

        try {
            $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            // nothing to do
        }

    }

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

        $bootstrap = Bootstrap::create(BP, $_SERVER);
        $objectManager = $bootstrap->getObjectManager();
        $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime');
        $date = $objDate->gmtDate();

        $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
        $connection = $resource->getConnection();
        $orderId = $observer->getEvent()->getOrderIds()[0];

        $sql = "INSERT INTO sap_orders (entity_id, order_id, sent, timestamp) Values (''," .
            $orderId .
            ", '" .
            "0" .
            "', '" .
            $date .
            "')" ;
        $connection->query($sql);

    }
}


texts: Magento 2 Knockout Shipping Method checked in shipping.html

texts:
I am looking for solution On checkout page where all shipping methods are loaded.

File path is vendor/magento/module-checkout/view/frontend/web/template/shipping.html

From above file we can see the code

 <!-- ko ifnot: method.error_message -->
                                <!-- ko if: $parent.rates().length == 1 -->
                                <input class="radio"
                                       type="radio"
                                       data-bind="attr: {
                                                    checked: $parent.rates().length == 1,
                                                    'value' : method.carrier_code + '_' + method.method_code,
                                                    'id': 's_method_' + method.method_code,
                                                    'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
                                                 }" />
                                <!-- /ko -->
                                <!--ko ifnot: ($parent.rates().length == 1)-->
                                <input type="radio"
                                       data-bind="
                                                value: method.carrier_code + '_' + method.method_code,
                                                checked: $parent.isSelected,
                                                attr: {
                                                    'id': 's_method_' + method.carrier_code + '_' + method.method_code,
                                                    'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code
                                                },
                                                click: $parent.selectShippingMethod"
                                       class="radio"/>
                                <!--/ko-->
                                <!-- /ko -->

Which is responsible for loading shipping radio buttons.

I want to checked radio button when Free shipping is loaded.How can I do this?
I need to check if else condition in knock out js but don't have more idea about Knckout JS.

Please help me how can I achieve this?


texts: magento2 Uncaught TypeError: Cannot read property 'value' of undefined

texts:
I have code:
if (name === 'category_ids') {
   //console.log(name);console.log(value) -> name:category_ids,value:81
   registry.get('customCategory').value(value);
}
if (name === 'country') {
   //console.log(name);console.log(value) -> name:country,value:null
   registry.get('customCountries').value(value);
}
if (name === 'province_ids') {
   //console.log(name);console.log(value) -> name:province_ids,value:["5"]
   registry.get('customProvince').value(value);
}

But when i run i have error managePost.js:196 Uncaught TypeError: Cannot read property 'value' of undefined. Please help me!


texts: Magento 2 : Product pages through exceptions

texts:
All Magento products were working properly last week. Now I check that all product pages through exceptions.
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'after': The attribute 'after' is not allowed.
Line: 1350

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'after': The attribute 'after' is not allowed.
Line: 1350

Please have a look, it's urgent
Any help is really appreciated


texts: setup-di-compile | PHP Fatal | Cannot declare class Magento\Framework\Console\Cli

texts:
When I try to run command setup:di:compile I get the following error:

[http]$ php-7.0 bin/magento setup:di:compile
The directory "/microcloud/domains/operm2/domains/domainname.co.uk/http/var/generation/Magento" cannot be deleted Warning!rmdir(/microcloud/domains/operm2/domains/domainname.co.uk/http/var/generation/Magento): Directory not empty#0 /microcloud/domains/operm2/domains/domainname.co.uk/http/vendor/magento/framework/Filesystem/Driver/File.php(403): Magento\Framework\Filesystem\Driver\File->deleteDirectory('/microcloud/dom...')
#1 /microcloud/domains/operm2/domains/domainname.co.uk/http/setup/src/Magento/Setup/Console/CompilerPreparation.php(68): Magento\Framework\Filesystem\Driver\File->deleteDirectory('/microcloud/dom...')
#2 /microcloud/domains/operm2/domains/domainname.co.uk/http/vendor/magento/framework/Console/Cli.php(74): Magento\Setup\Console\CompilerPreparation->handleCompilerEnvironment()
#3 /microcloud/domains/operm2/domains/domainname.co.uk/http/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#4 {main}

PHP Fatal error:  Cannot declare class Magento\Framework\Console\Cli, because the name is already in use in /microcloud/domains/operm2/domains/domainname.co.uk/http/Cli.php on line 0

Fatal error: Cannot declare class Magento\Framework\Console\Cli, because the name is already in use in /microcloud/domains/operm2/domains/domainname.co.uk/http/Cli.php on line 0

Anyone came across this before? Running Magento ver. 2.1.8


texts: Best way to store store_id in dedicated database table

texts:
I've created a module that stores a CMS-block like entity in a dedicated database. Just like a widget. Lets call it my_custom_widget.

I want to determine wheter my_custom_widget should be used for store (id: 1) and/or store 2 (id: 2).

In my Form.php file I have this node:

$fieldset->addField('store_id', 'multiselect', array(
    'name'      => 'store_id',
    'label'     => Mage::helper('my_custom_widget_extended')->__('Store View'),
    'title'     => Mage::helper('my_custom_widget_extended')->__('Store View'),
    'required'  => true,
    'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
));

This is somehow copied from a core module of Magento, but slightly modified for my needs.

However, if I want to save it, it returns an error because the PDO-adapter cannot store an array in a database obviously.

Would I rather:
1. insert it twice, foreach store (without creating two visible entities in the grid)
2. just store a comma seperated string?

Whats the prefered, best way to do this?


texts:
How to change logo location in Magento CE 2.0.2 ?

I want to move logo to header.panel block.

Tried to do it through layout/xml but that only provides changing position (before/after).

Any help appreciated.


texts: Collect order total inside shipping method

texts:
I created my own shipping method but I want the price to be set as 10% of the subTotal.

I think I should use something of the session or the quote cart inside the collectRates function of Magento but I can't seem to figure it out.

Can you help me out?

public function collectRates(RateRequest $request)
{
    if (!$this->getConfigFlag('active')) {
        return false;
    }

    /** @var \Magento\Shipping\Model\Rate\Result $result */
    $result = $this->_rateResultFactory->create();

    /** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
    $method = $this->_rateMethodFactory->create();

    $method->setCarrier('percentagetotaal');
    $method->setCarrierTitle($this->getConfigData('title'));

    $method->setMethod('percentagetotaal');
    $method->setMethodTitle($this->getConfigData('name'));

    $percentage = 10;
    // I want to get the session and get the cart subtotal and calculate 10% of the $subTotal.
    // How to get $subTotal;
    $price = ($subTotal * $percentage) / 100; //calculate 10% of the product cost

    $method->setPrice($price);
    $method->setCost($price);

    $result->append($method);

    return $result;
}

So I want to know how to get $subTotal inside the collectRates function.


texts: how to add store link in invoice pdf magento

texts: how can I add store link in invoice pdf under logo in magento 1.9


texts:
pretty new to magento 2, but Is it possible to set up a credit account in magento 2?

So a customer can purchase items (up to a limit) and then get invoiced at the end of the month.

Another option might be that the customer can pay with a P.O. (as a payment method) but how would this be set up so only approved customers can pay that way?

And then how would the customers apply for a credit account?

Many thanks in advance


texts: Magento custom block not showing on frontend

texts:
I'm trying to create custom block to show some info on the page, but got some weird issue that this block not showing. Already broke my brain by trying to debug why.
There are some code snippets:
config.xml

<config>
<module>
    <Module_Design>
        <version>0.0.2</version>
    </Module_Design>
</module>
<global>
    <helpers>
        <module_design>
            <class>Module_Design_Helper</class>
        </module_design>
    </helpers>
    <models>
        <module_design>
            <class>Module_Design_Model</class>
        </module_design>
    </models>
    <blocks>
        <module_design>
            <class>Module_Design_Block</class>
        </module_design>
    </blocks>
</global>
<frontend>
    <layout>
        <updates>
            <module_design>
                <file>module/design.xml</file>
            </module_design>
        </updates>
    </layout>
</frontend>
<default>
    <module_design>
        <notification>
            <!-- Promotion bar -->
            <stickybanner_enabled>0</stickybanner_enabled>
            <stickybanner_position>top</stickybanner_position>
            <stickybanner_visibility>default</stickybanner_visibility>
            <stickybanner_sort_order>1</stickybanner_sort_order>

            <!-- Cookie Opt-In -->
            <cookie_optin_enabled>1</cookie_optin_enabled>
            <cookie_optin_position>top</cookie_optin_position>
            <cookie_optin_visibility>default</cookie_optin_visibility>
            <cookie_optin_lifetime>604800</cookie_optin_lifetime>
            <cookie_optin_sort_order>0</cookie_optin_sort_order>
        </notification>
    </module_design>
</default>

design.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="after_body_start">
            <block type="core/text_list" name="design.notifications">
                <block type="module_design/notification_stickybanner" name="module_design_notification_stickybanner"
                       as="stickybanner" template="module/design/notification/stickybanner.phtml"/>
            </block>
        </reference>
    </default>
</layout>

Stickybanner.php

class Module_Design_Block_Notification_Stickybanner extends Module_Design_Block_Notification_Abstract
{
    ...

    /**
     * check, if the notification should be shown
     *
     * @return bool
     */
    public function isShown()
    {
        if (!parent::isEnabled()) {
            return false;
        }
        if ($this->isTypeDefault()) {
            return true;
        }
        if (Mage::getModel('core/cookie')->get($this->_cookieName)) {
            return false;
        }
        return true;
    }
    ...

template stickybanner.phtml

<?php
/* @var $this Module_Design_Block_Notification_Stickybanner */
if (!$this->isShown()) {
    return;
}
?>


texts: Magento 2 : When you upload a thumbnail or category image in Magento 2 where does it go?

texts:
I am trying to find the filepath for where a category image or thumbnail goes after being uploaded in admin.

Can anyone point me in the correct direction?


texts: Create a Programmatic attribute that detects product if it is Still On Sale or New

texts:
Scenario wanted:
Lets say you have multiple products that is on sale till a specific date each product with its own time and you want to create a promotion condition rule for all these products under one condition that the time is still valid.

This attribute is important to detect On Sale products and New products and can be used with many other extensions such as product labels extension or promotion rule extension because using default magento attribute it will be hard to refer to these products with valid time.

I am looking to create an extension that creates a product attribute with a value true or false (yes or no) but filled in programmatically according to the time "from" and "to" if it is valid and set the value to yes or no.
So if the product is still on sale the attribute value will be yes.
And if product is still new another attribute value will be yes.

Can any one help in creating such module.

For creating an attribute mageplaza offers a guide for it at:
https://www.mageplaza.com/magento-2-module-development/magento-2-add-product-attribute-programmatically.html
So in my case i want to create 2 attributes one for Sale and one for New and i want to fill this newly created attribute Programmatically according to time if valid or not.


texts: has quantity_and_stock_status been deprecated?

texts: Has the 'quantity_and_stock_status' been deprecated from Magento 2? Why is there no documentation for this?


texts:
How many people on here are Magento certified?

What was your experience with the process? Since becoming certified, do you believe your certification has provided any benefits to your work or career?


texts: I am facing the issue in my magento store i have create module its working fine on local ,dev enivorment but on live some time its not work and give error not found what will be the issue


texts: Show all sale products or new products like in a category page with layered navigation Magento 2

texts: How can I Show all sale products or new products like in a category page with layered navigation?


texts: How Reindex and Reset programmatically in magento 2?

texts:
I Need to reindex and reset the indexer programmatically using external script from magento root.

How can i achieve this.Is there a Way to do this.?

I am new in magento. Please help me.

Thanks in Advance.


texts:
new THREE.WEBGLRENDER Three is not defined when i'm using it in Magento 2 with requirejs .
THREERENDERER = new THREE.WebGLRenderer({ context: spec.GL, canvas: spec.canvasElement });</quo
you can check here https://neareo.retroplus.ma/ . A bot will come.. press Ok button and allow camera access..and then see on console for error
N:B All js files are there loading properly .You can see on network
Thanks in advance for help


texts: Invalid shipping address #10736 error with PayPal express checkout

texts:
I am getting the following error every time I try to use paypal express checkout from my site though my shipping address is valid.

PayPal NVP gateway errors: A match of the Shipping Address City, State, and Postal Code failed (#10736: Shipping Address Invalid City State Postal Code).

I have searched a lot about this, but couldn't get the right solution. Please guide me at this point. Advice from any one will highly appreciate.


texts: Why is "can't find the quote item." showing up when i click add to cart?

texts:
I have seen this issue on both chrome, IE, and safari for the site in question, across devices and ISPs. I was able to capture the source code and errors for this happening in the product page, the cart, and a variation on chrome last week. Below I have shared view-only google docs that will allow you to see the code, screenshots of what the issue looks like, and the error that shows up on the page. I have highlighted the section of code that i THINK is the culprit, but please note I am not a coder, so the code below might not be the culprit. The google docs are like 70 pages each but I didn't want to leave anything out. :)

Product Page Error Code: https://docs.google.com/document/d/1n_6_ilrpQFIb_g_4J9Vu-F3s0Jfm-pKDCDrc5P9_9ng/edit?usp=sharing

Product Page red Error Code AND green OK:
https://docs.google.com/document/d/1pc1wWeKKamBFE3oyAyTlBvPjdMrNibsFe-jAEHbYye4/edit?usp=sharing

Cart Error Code: https://docs.google.com/document/d/1wYjCbWgBVzcIsZdLy0MQPDuCou3CMr61Tztt0HFEslE/edit?usp=sharing

No issue in the cart: https://docs.google.com/document/d/1nvxdoOL-Q_HyoZ9qmYu_DDFmluzYSDLJYYfGLKVf-XU/edit?usp=sharing


texts: Magento 2: Checkout button on product page

texts: Is there a way to add a 'Add to Cart and Checkout' button to the product page, so that the product is added to the cart and then takes the user straight to the checkout?


texts:
I was wondering if someone had a set of best practices or an example of a template that uses Angular.js with Magento.

I am working on a template with javascript functions and I wanted to use Angular.js, do you have any recommendations and is it recommended to use this framework?


texts: How can I find my custom order attribute?

texts:
When I export my orders I have a custom attribute called "calc_fields" somehow saved inside "product_options" under "info_buyRequest"

The information is saving correctly in my event listener when a product is added to the cart. I have data that saves using

   $items[0]->setData("calc_fields", $calcFields);

This means that the calc_fields attribute was created at one point.  In my history I have no code related to creating an attribute for calc_fields. And when I check my database tables:

sales_flat_order

sales_flat_order_item

sales_flat_quote_item_option

When I go to any of these tables and click to view the Structure in cPanel the attribute "calc_fields" doesn't exist.

How can I be referencing this attribute and saving data to it if it isn't in my database?


texts: Special price disappears after editing product

texts:
As the title says. After I set a Catalog Price Rule for multiple products and/or brands, and if I want to edit a product that has the special price, the price just resets to its original state.
Is this a known issue or feature?


texts: Category Custom Attribute in rest API in Magento 2

texts:
I am using magento 2.2.7 and I am creating rest API for Category. From swagger I am getting value like:

{
"id": 28,
"parent_id": 2,
"name": "Smart Phones",
"is_active": true,
 "position": 1,
"level": 2,
"children": "",
"created_at": "2018-11-03 01:32:45",
"updated_at": "2019-01-14 06:33:52",
"path": "1/2/28",
"available_sort_by": [],
"include_in_menu": true,
"custom_attributes": [
  {
    "attribute_code": "display_mode",
  "value": "PRODUCTS"
},
{
  "attribute_code": "is_anchor",
  "value": "1"
},
{
  "attribute_code": "path",
  "value": "1/2/28"
},
{
  "attribute_code": "children_count",
  "value": "0"
},
{
  "attribute_code": "custom_use_parent_settings",
  "value": "0"
},
{
  "attribute_code": "custom_apply_to_products",
  "value": "0"
},
{
  "attribute_code": "url_key",
  "value": "smart-phones"
},
{
  "attribute_code": "url_path",
  "value": "smart-phones"
},

{
  "attribute_code": "tamil",
  "value": "பேக்குகள் & லக்கேஜ்"
},
{
  "attribute_code": "telugu",
  "value": "బ్యాగ్స్ & లగేజీ"
}
]
}

In which  "attribute_code": "telugu", and   "attribute_code": "tamil", is custom attribute. and it is coming inside the custom Attribute array.
I want this parameter outside of custom attribute along with NAME and ID.
Please help me to achieve this.


texts: Category pages disabled javascript functions

texts:
When I go to a category page on my Magento installation since a couple of weeks I do not have a working search/mobile menu/language switcher:

https://www.thefixedgearshop.com/beat-the-heat-sale

When trying to switch the language in a category it adds a # and doesn't open the JavaScript that is needed. When on Homepage/CMS page/Product page everything works great.

I cannot figure out where the bug is taking place. The Console doesn't tell me enough.