texts: Could not add pagination while fetching product as per category ID

texts:
I am using end point API to fetch product as per category id and want to add pagination on it but in my code its not happening like this. I am explaining my code below.

$quoteUrl ='http://example.com/index.php/rest/V1/categories/67/products?searchCriteria[filterGroups][0][filters][0][field]=entity_id&searchCriteria[filterGroups][0][filters][0][condition_type]=eq&searchCriteria[pageSize]=1&searchCriteria[currentPage]=2';
$chQuote = curl_init($quoteUrl);
curl_setopt($chQuote, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($chQuote, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
curl_setopt($chQuote, CURLOPT_RETURNTRANSFER, true);
$quote = json_decode(curl_exec($chQuote));
$array = json_decode(json_encode($quote), True);
echo json_encode($array);

Here I need to fetch products as per category id(i.e-67) and add the pagination also means lets say per page user needs to display 2 product only. A per my code all products are coming and pagination is not working. Please help me to resolve this issue.


texts:
I have a category with more than 50K products therefore whenever I click on it in admin "Manage Categories" it gives me memory exhaust error, now I want to only load products when I click on "Category Product" tab or a button in phtml file which loads product in the grid.

Can someone guide through steps to load grid from phtml with working filters and selection?


texts: How to downgrade Magento Enterprise 2.3.1 to Community edition

texts:
My website use Magento EE 2.3.1, I want to downgrade to Magento CE 2.3.2. How can I do it?

Any help would be greatly appreciated.


texts: Magento 2 not able to override Magento\Sales\Block\Order\Email\Items\DefaultItems.php file

texts:
I am trying to override this file :-

  Vendor/Module/Block/Order/Email/Items

i call this file in my di.xml Here is xml code

  Vendor/Module/etc/di.xml

  <?xml version="1.0"?>
   <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <preference for="Magento\Sales\Block\Order\Email\Items\DefaultItems" type="Vendor\Module\Block\Order\Email\Items\DefaultItems" />
   </config>

On following path i have create DefaultItems.php

  Vendor/Module/Block/Order/Email/Items

Here is code of DefaultItems.php

<?php

namespace Vendor\Module\Block\Order\Email\Items;

use \Magento\Sales\Model\Order\Creditmemo\Item as CreditmemoItem;
use \Magento\Sales\Model\Order\Invoice\Item as InvoiceItem;
use \Magento\Sales\Model\Order\Item as OrderItem;

/**
 * Sales Order Email items default renderer
 *
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class DefaultItems extends \Magento\Sales\Block\Order\Email\Items\DefaultItems
{
    public function getAdditionalOptionData()
    {

        return "hello";
    }

}

In this file

  app/design/frontend/Vendor/Theme/Magento_Sales/templates/email/items/invoice/default.phtml

I have write following code

echo $block->getAdditionalOptionData(); die;

Now, when i send invoice email from admin, my code is not working. It should display hello.

When i put di.xml file code in comment and add function getAdditionalOptionData in magento vendor file, hello display.

I am using magento 2.1.6

Can anyone please let me know where i make mistake?


texts: What increases the size of the Magento account? What can I delete to decrease the size? I'm up to 13.62 GB on the cPanel backup

texts:
Magento 1.9.1.0
890 products

When I do a cPanel backup of my account - it comes up to be 13.62 GB. I think that it makes a backup of the Email also - the total size of the Email should be around 3 GB (2984 MB). Which would indicate the size of the Magento store to be around 10.6 GB in the tar.gz compresssed format. I deleted the Cache folder. What are other things I can delete? Is the var/report folder OK? Anything else? Would deleting any of the unnecessary folders make Magento run faster?


texts:
I downloaded the official php7 support patch PATCH-1.9.3.0_PHP7-2018-09-13-07-59-59.2_v2 from here.

I noticed that the file is downloaded without any extension, so I renamed it from PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2 to PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh.

Then I executed the patch sh PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh.
But this is what I get:

diff: unrecognized option '--git'
diff: Try 'diff --help' for more information.
PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh: line 2: index: command not found
PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh: line 3: ---: command not found
PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh: line 4: +++: command not found
PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh: line 5: syntax error near unexpected token `('
PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2.sh: line 5: `@@ -53,6 +53,9 @@ if (defined('COMPILER_INCLUDE_PATH')) {'

Tested on a fresh Magento V1.9.3.10.
Do we have to patch the patch?

I installed another patch which also has the same diff --git command and that worked, but this patch wont work.

UPDATE

I tried it like this: git apply PATCH-1.9.3.1-1.9.3.9_PHP7-2018-09-13-08-01-43.2_v2

Im not sure if it worked because there was no output.

  Note: You can install these patches using either patch or git apply
  . See the Instructions section of the Magento 1 Official
  PHP 7.2 patches blog post for more information on both forms of
  installation.

Info found here.


texts: The requested Payment Method is not available

texts:
I'm trying to create order programmatically by following code but getting payment not available.

$customer = Mage::getModel('customer/customer')->load($data->user);
$quote =Mage::getSingleton('checkout/session')->getQuote();
// Assign Customer To Sales Order Quote
$quote->assignCustomer($customer);
$quote->getBillingAddress();
$quote->getShippingAddress();

// Collect Rates and Set Shipping & Payment Method
$shippingAddress->setCollectShippingRates(true)
          ->collectShippingRates()
          ->setShippingMethod('flatrate_flatrate')
          ->setPaymentMethod('checkmo');
$quote->getPayment()->importData(array('method' => 'checkmo'));
try {
    // Collect Totals & Save Quote
    $quote->collectTotals()->save();
    // Create Order From Quote
    $service = Mage::getModel('sales/service_quote', $quote);
    $service->submitAll();
    $increment_id = $service->getOrder()->getRealOrderId();
}
catch (Exception $ex) {
    echo $ex->getMessage();
}
catch (Mage_Core_Exception $e) {
    echo $e->getMessage();
}
$quote = $customer = $service = null;
// Finished
echo  $increment_id;


texts: How to Move Products, Attributes, Images, and Customers From One Magento Installation to Another

texts:
I have Magento 1.9.2.1 installed and I also installed a test Magento installation in a subdomain. Basically, the theme I have installed on my current Magento installation was designed for an older version of Magento. I installed a new responsive theme designed for 1.9.x installed on the test Magento installation. Note that both Magento installations are 1.9.2.1.

I need to copy all products along with images and attributes from the current Magento installation to the test installation. I would like to be able to copy the customers as well, but it's not completely necessary. How can I do this? Any and all details would be appreciated. I've tried various ways with the Export/Import Data Profiles and keep getting errors (image not present, etc.)

My goal is to copy all products, images, attributes and possibly customers to the test site. Then, remove the original installation and move the test site to take it's place. My old theme on the original installation is very integrated into the files and almost impossible to remove. I needed to start fresh.

EDIT: I'm at my wits end on this. I cleared all logs in the database and exported it again. I uploaded it via FTP and against tried to import it to the new database via SSH and I get this exact error: ERROR 1062 (23000) at line 22349: Duplicate entry '3-13-70-0' for key '479DA1DD8CED295B97C96AEF816CA4EE'

I also was able to export the database into a gzip file and attempt to import it via phpMyAdmin. I get the same error..


texts: Magento 1.9.0.1 hunk #1 failed when installing SUPEE-8788 v2

texts:
I'm trying to install SUPEE-8788 v2 on magento 1.9.0.1 and I get the error message

  patching file downloader/lib/Mage/HTTP/Client/Curl.php

  Hunk #1 FAILED at 372.

  1 out of 1 hunk FAILED
  -- saving rejects to file downloader/lib/Mage/HTTP/Client/Curl.php.rej

  patching file js/lib/uploader/flow.min.js
  patching file js/lib/uploader/fusty-flow-factory.js
  patching file js/lib/uploader/fusty-flow.js
  patching file js/mage/adminhtml/product.js
  patching file js/mage/adminhtml/uploader/instance.js
  can't find file to patch at input line 5810
  Perhaps you used the wrong -p or --strip option?

I've tried to look up the curl.php.rej file, but it doesn't exist. I'm not even sure what the error message means, does the script fail at line 372, or does it fail to adjust something in curl.php at that line?

What can I do to solve this error?

I've installed all required previous patches for this version.

--edit--

I've installed 3941 and now the patch halts at another point.

  patching file js/mage/adminhtml/uploader/instance.js
  can't find file to patch at input line 5810
  Perhaps you used the wrong -p or --strip option?

  The text leading up to this was:

  |diff --git lib/Unserialize/Parser.php lib/Unserialize/Parser.php
  |index 423902a..2c01684 100644
  |--- lib/Unserialize/Parser.php

  |+++ lib/Unserialize/Parser.php

  File to patch:
  Skip this patch? [y]
  Skipping patch.
  1 out of 1 hunk ignored

There is no instance.js and no Parser.php. I've looked in the original 1.9.0.1 source as well and both files don't exist there, so I assume they should be created by the script. The script has enough rights to create files and folders, are there other things I can check?

New update

In the end I've applied certain parts of the patch manually to get it working. These were the step I had to take:

install patch 3941 (1533 wasn't installed)
remove the binary data from the patch so I could edit it in a editor
added js/mage/adminhtml/uploader/instance.js manually
added lib/unserialize from 1.9.3
removed the swf's manually

Hope this helps someone.


texts:
I am trying to filter my collection from my custom table using _initSelect method in class Collection in namespace Anshu\Custom\Model\ResourceModel\MyData

protected function _initSelect()
    {
        // code for filtering collection
    }

But it is not going through this method.

Am I following the correct approach?
What can I filter my collection to show data in Grid in admin?


texts:
I want to implement Adobe XD design on Magento theme
Hi Everyone!

I am new to Magento but I am front end developer.. I want guidance

Designer gave me design in Adobe xd about website different page like product , Contact us and about us

and menu

Now I want to implement it in my Magento Store

But What do I do?

Do I need to convert page design into html css code and then implement it as Magento theme ??

or???


texts: Overwrite Block causes constructor error - how can I add to it?

texts:
I have a block which extends/overwrites the Magento block:

\Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo

This works perfectly. However in one of my classes I want to access a Helper, and so I added the consutructor

public function __construct(
    \Magento\Backend\Block\Template\Context $context,
    \Vendor\Name\Helper\SomeHelper $someHelper,
    array $data = []
) {
    parent::__construct($context, $data);
    $this->someHelper = $someHelper;
}

public function getSomething(){
    return $this->someHelper->getSomething();
}

  Fatal error: Uncaught TypeError: Argument 2 passed to
  Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo::__construct()
  must implement interface
  Magento\Customer\Api\AccountManagementInterface, array given, called
  in
  \app\code\retracted\retracted\Block\AdminOverrideBlocks.php
  on line 144 and defined in
  \vendor\magento\module-customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo.php
  on line 126 ( ! ) TypeError: Argument 2 passed to
  Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo::__construct()
  must implement interface
  Magento\Customer\Api\AccountManagementInterface, array given, called
  in
  \app\code\retracted\retracted\Block\AdminOverrideBlocks.php
  on line 144 in
  \vendor\magento\module-customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo.php
  on line 126

I know that the helper works, thats no problem. But this constructor overwrites the one on the Orginal Magento block - which causes errors.

I don't really want to copy and paste the entire constructor from the Magento block for various reasons (bound to cause issues down the road, not exactly elegant) and even when I tried this, I couldn't get past all the errors.

Is there a way to do it as a above but have the constructor inherited as opposed to overwrite? Or is there another way to access the helper without the requirement of the constructor?


texts: Checkout payment failed email to customer

texts:
I want to send email to customer on checkout payment fail. That he can use alternative payment methods and etc. I can edit payment transaction failed template for this purpose and I know can change things about this at  Configuration>Checkout but where I can find the option for customer email?
This question is also asked on Magento-forum but no proper answer is provided by any one.

Any help regarding this would be highly appreciated. Thanks in advance.


texts: Magento filter Collection by Date attribute value

texts:
I would like to know. How can i filter collection by attributes specially When Catalog Input Type for Store Owner is DATE.

Each product will have a future date when there stock will be set as out of stock no matter what is stock qty. And i want to pragmatically set this by filter product based on that future date if future date match with any product that product will set as out of stock. I just dont know how can filter product based on a future date where i can check if its match with that date or not. I hope you understand.


texts: Attribute's option : use in attribute set (or not)

texts:
How to retrieve only certains attribute's options for a given attribute set, in admin, in new product and edit form
?

For Example, two attribute set (e.g., set-1 and set-2).

In each, color attribute is assigned and color has options (e.g., blue, yellow, green, red).

The goal of the question is to be able to set 'blue' and 'yellow' as available options of color in set-1,

and to set 'green' and 'red' as available options of color in set-2,

instead of having all options.

Any suggestion is welcome.


texts: After data migration to Magento 2: system attributes missing

texts:
I migrated from Magento 1.6.2 to 2.0.2 with the official data migration tool.

In general, it worked. But I cannot modify any product (no field is displayed).
I suspect it is due to the fact that all the new system attributes (like category_ids) and the set of attributes "Default" are missing.

I just don't know why these attributes are removed and what to do about them.

Any help is greatly appreciated!


texts:
I'm trying to override a file in my theme, but its not showing.
The file is located in
vendor/mollie/magento2/view/frontend/web/template/payment/creditcard-with-components.html.
location of my file is
Vendor/Theme/Mollie_Magento2/web/template/payment/creditcard-with-components.html.
Is this path wrong?


texts: Force Customer to register in Magento 2 checkout

texts:
What can I do if I want the customer to register in the check out process?
Is there any simple way to do it?

I want the user register from the billing information where users are required to fill in the password and email.


texts:
I've tried everything on the register forms for a theme I'm working with in Magento. The theme I'm using is Proto. Here's the problem:

• My site is installed on a sandbox environment. Specifically it is on an Amazon EC2 Linux instance. I am just using the standard EC2 URL that comes with the instance during development.

• If I try to submit any forms when the theme is active, nothing works. The pages just reload. This includes registration, login, add to cart, etc.

• If I activate the Magento Blank theme, these forms all work.

• I've inspected the Network events on the signup form for both themes and they both have the same payload. This does not appear to be the issue that most people have where the 'form key' is not on the form. It is there on the theme that doesn't work.

It makes me think this is something with the theme, not with server or with the setup since I can simply just switch themes and it works. It's possible it has something to do with the server side code handling this. I'm suspicious of the theme as well because one of our devs was working on it and I'm not entirely sure he didn't change something crucial.

Other things I've tried:

• I've tailed the apache log for both access and error during the form submissions and see nothing out of the ordinary.

• I've attempted to turn on debug logging through Magento but running this on the command line:

php bin/magento config:set dev/debug/debug_logging 1 && php bin/magento cache:flush

per this post: Magento 2 - Turn on / off debug log but that debug.log file doesn't appear to show up at all (or I'm not doing anything that is causing it to show up).

At this point, I'm just trying to think of new approaches. I'm not very well versed in Magento and just need some other ideas on how I can potentially log/debug/troubleshoot the problem.


texts:
I want to implement custom full text search functionality for front end that fetch result only from company table.
Kindly please let me know if you guys have any idea.
In frontend User can search with a keyword it may match with company street address or company name or company city or state.
so based on that in frontend need to show companies list.
Thanks!!


texts: Magento 2 : How to save value of custom attribute defined in customer registration form in frontend?

texts:
InstallData.php

<?php
namespace Pulsestorm\NewModule\Setup;

use Magento\Customer\Setup\CustomerSetupFactory;
use Magento\Customer\Model\Customer;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Eav\Model\Entity\Attribute\SetFactory as AttributeSetFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
 * @codeCoverageIgnore
 */
class InstallData implements InstallDataInterface
{

    /**
     * @var CustomerSetupFactory
     */
    protected $customerSetupFactory;

    /**
     * @var AttributeSetFactory
     */
    private $attributeSetFactory;

    /**
     * @param CustomerSetupFactory $customerSetupFactory
     * @param AttributeSetFactory $attributeSetFactory
     */
    public function __construct(
        CustomerSetupFactory $customerSetupFactory,
        AttributeSetFactory $attributeSetFactory
    ) {
        $this->customerSetupFactory = $customerSetupFactory;
        $this->attributeSetFactory = $attributeSetFactory;
    }

    /**
     * {@inheritdoc}
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {

        /** @var CustomerSetup $customerSetup */
        $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);

        $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer');
        $attributeSetId = $customerEntity->getDefaultAttributeSetId();

        /** @var $attributeSet AttributeSet */
        $attributeSet = $this->attributeSetFactory->create();
        $attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

        $customerSetup->addAttribute(Customer::ENTITY, 'code', [
            'type' => 'varchar',
            'label' => 'code',
            'input' => 'text',
            'required' => false,
            'visible' => true,
            'user_defined' => true,
            'sort_order' => 1000,
            'position' => 1000,
            'system' => 0,
        ]);

        $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'code')
        ->addData([
            'attribute_set_id' => $attributeSetId,
            'attribute_group_id' => $attributeGroupId,
            'used_in_forms' => ['adminhtml_customer','customer_account_create','checkout_register','customer_account_edit'],
        ]);

        $attribute->save();

    }
}

customer_account_create.xml

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

    <referenceContainer name="form.additional.info">
        <block class="Magento\Framework\View\Element\Template" name="my_form_additional_info_customer" template="Pulsestorm_NewModule::customer.phtml"/>
    </referenceContainer>

</page>

customer.phtml

 <fieldset class="fieldset create account" >
        <legend class="legend">
          <?php /* @escapeNotVerified */ echo __('Additional Information') ?>
        </legend>

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

            <input type="text" name="regulation" id="code" title="<?php /* @escapeNotVerified */ echo __('Code') ?>" class="input-text" data-validate="{required:false}">

  </fieldset>

Attribute showing at backend and frontend, from backend value is saving (customer create page) but not from frontend.


texts: Magento 2,How to add google reCaptcha on the PayPal Payflow payment method in checkout page

texts: I want to add Google reCaptcha on the Checkout page. Is there any way to add google reCaptcha on PayPal payment method?


texts: Magento 2 API want to implement product details based on custom format?

texts:
Magento 2 how to implement configurable product collection formate as shown blow  can you please suggest me.

Required format:-

{
    "id": 10,
    "name": "Hello",
    "sku": "hello"
    "description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."
    "brand": "Nutridiet",
    "position": 1,
    "url_key": "null",
    "url": "http://hostmname.com/hello.html",
    "express_delivery":"yes",
    "collection":"no",
    "status":1,
    "is_offer": "yes",
    "offer_text": "Buy 1 get 1 free",
    "store_id": 1
    "children_data": [
        {
            "id": 3,
            "parent_id": 2,
            "name": "Hello Test 2",
            "sku": "Hello-Test-2",
            "status": 1,
            "position": 1,
            "weight": "500",
            "price": 7.50,
            "special_price": 5,
        },
        {
            "id": 4,
            "parent_id": 2,
            "name": "Hello",
            "sku": "Hello-Test-3",
            "status": 1,
            "position": 2,
            "weight": "1.00",
            "price": 15,
            "special_price": ,
        },
        {
            "id": 5,
            "parent_id": 2,
            "name": "Hello-Test-4",
            "sku": "Hello-Test-5",
            "status": 1,
            "position": 3,
            "weight": "1.00",
            "price": 20,
            "special_price": ,
        }
    ]
}

default Magento 2 existing format:

Note:- As of now by default Magento 2 providing the format is

             "id": 82,
            "sku": "Jai",
            "name": "javan",
            "attribute_set_id": 4,
            "price": 0,
            "status": 1,
            "visibility": 4,
            "type_id": "configurable",
            "created_at": "2017-12-13 06:05:03",
            "updated_at": "2017-12-13 06:05:03",
            "product_links": [],
            "tier_prices": [],
            "custom_attributes": [
                {
                    "attribute_code": "meta_title",
                    "value": "Onions17"
                },
                {
                    "attribute_code": "meta_keyword",
                    "value": "Onions17"
                },
                {
                    "attribute_code": "meta_description",
                    "value": "Onions17 "
                },
                {
                    "attribute_code": "image",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "small_image",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "thumbnail",
                    "value": "/o/n/onion-05_copy_9_1.png"
                },
                {
                    "attribute_code": "options_container",
                    "value": "container2"
                },
                {
                    "attribute_code": "required_options",
                    "value": "1"
                },
                {
                    "attribute_code": "has_options",
                    "value": "1"
                },
                {
                    "attribute_code": "url_key",
                    "value": "onions17"
                },
                {
                    "attribute_code": "gift_message_available",
                    "value": "2"
                },
                {
                    "attribute_code": "tax_class_id",
                    "value": "2"
                }
            ]
        }


texts: How to add products into cart programatically once after an checkout_cart_product_add_after is triggered? in Magento 2.2.x

texts:
<?php
namespace Commerceshop\Vendor\Model;

    use Magento\Framework\Event\ObserverInterface;
    use Psr\Log\LoggerInterface as Logger;

    class Observer implements ObserverInterface
    {

        protected $catalogProductFactory;
        protected $checkoutCart;
         protected $_productRepository;
    protected $_cart;
    protected $formKey;
        public function __construct(\Magento\Catalog\Model\ProductRepository $productRepository, \Magento\Checkout\Model\Cart $cart, \Magento\Framework\Data\Form\FormKey $formKey,
                \Magento\Catalog\Model\ProductFactory $catalogProductFactory,
                \Magento\Checkout\Model\Cart $checkoutCart,
                Logger $logger
        ) {
                $this->catalogProductFactory = $catalogProductFactory;
                $this->checkoutCart = $checkoutCart;
                $this->_logger = $logger;
                $this->_productRepository = $productRepository;
                $this->_cart = $cart;
                $this->formKey = $formKey;
        }
        public function execute(\Magento\Framework\Event\Observer $observer) {

            /*$productCollection = $this->_productloader->create()->load();*/

             $product1 = $observer->getEvent()->getProduct();
             $item=$observer->getEvent()->getData('quote_item');
            $product=$observer->getEvent()->getData('product');
            $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
            $product->getQty();

            $params = array(
                'product' => 20,
                'qty' => 1
            );

            $_product = $this->_productRepository->getById(20);
            $this->_cart->addProduct($_product,$params);
            $this->_cart->save();
    }
}

I have tried this code but no luck and no err indeed. Give me a kick to go further.
Thanks,


texts: How to load all child block in controller

texts:
I am using Ajax to add to cart, so need to update the cart side bar.

I have try this code in controller to render the block.

Mage::app()->getLayout()->getBlockSingleton('page/html')->setTemplate("page/html/upper.phtml")->toHtml();

but it render the parent block and doesn't render the child blocks.

And layout file is

   <block type="core/text_list" name="upper" as="upper" template="page/html/upper.phtml">
       <block type="checkout/cart" name="top.cart" as="cart_overview">
            <action method="setCartTemplate"><value>checkout/topcart.phtml</value></action>
            <action method="setEmptyTemplate"><value>checkout/cart/cartEmpty.phtml</value></action>
            <action method="chooseTemplate"/>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
       </block>
   </block>

how can i render child block in controller.

Assist me.


texts: Is it possible to create an account/integration with only the permissions of read-only to the catalog? The reason is that I want certain customers to be able to access the prices of products within Magento but not update any information


texts: How to create Guest Wishlist For Magento

texts: In Magento, the default functionality is that the customer click a wishlist link on any product when that customer is not logged in, then it redirects to login page and then the product has been stored in wishlist and shows in wishlist page after logged in. But according to requirement, I need the wishlist functionality for non logged in Customer also. The non logged in customer is capable to click a wishlist link and save and see the wishlist without logged in. That mean I think guest wishlist for magento. If any one knows about it. Please reply me as soon as possible.


texts: updateAttributes cannot be used to enable a product? (price index not updated)

texts:
We are enabling a disabled product with \Magento\Catalog\Model\Product\Action::updateAttributes
$this->productAction->updateAttributes([$magentoProductId], [
     'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
], 0);

This leads to the product not beeing displayed in the categories, because of the price index.
(if I run a full reindex, it appears)
When looking into the method
public function updateAttributes($productIds, $attrData, $storeId)
{
    $this->_eventManager->dispatch(
        'catalog_product_attribute_update_before',
        ['attributes_data' => &$attrData, 'product_ids' => &$productIds, 'store_id' => &$storeId]
    );

    $this->_getResource()->updateAttributes($productIds, $attrData, $storeId);
    $this->setData(
        ['product_ids' => array_unique($productIds), 'attributes_data' => $attrData, 'store_id' => $storeId]
    );

    if ($this->_hasIndexableAttributes($attrData)) {
        $this->_productEavIndexerProcessor->reindexList(array_unique($productIds));
    }

    $categoryIndexer = $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID);
    if (!$categoryIndexer->isScheduled()) {
        $categoryIndexer->reindexList(array_unique($productIds));
    }
    return $this;
}

We see that it only triggers Category and EAV indexer. Why is this limitation?
Is there another quick way to enable a product (without doing a full save operation)?
Should I just trigger all the other indexes manually?
EDIT:
As a workaround
n98-magerun2 index:reindex catalog_product_price;

helps, but adding
    $priceIndexer = $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID);
    if (!$priceIndexer->isScheduled()) {
        $priceIndexer->reindexList(array_unique($productIds));
    }

does not seem to help
UPDATE:

Index is configured on save

I still added the patch with the price Indexer and now update the price to a random value as well (customer_group is a custom attribute)
      $this->productAction->updateAttributes([$magentoProductId], [
          'customer_group' => $groups,
          'status' => $magentoVisibility,
          'price' => rand(0,1000),
      ], 0);

Still the same result
UPDATE2: Based on Diana's answer, this updates the price index as a  workaround:
        $this->productAction->updateAttributes([$magentoProductId], [
            'customer_group' => $groups,
            'status' => $magentoVisibility,
        ], 0);

        $this->productAction->updateAttributes([$magentoProductId], [
            'price' => rand(0,1000),
        ], 0);


texts: How to add configuration button in system.xml file?

texts: I want to add a button in the system.xml file that is linked to the google home page in the system.xml file.


texts: "Unable to send mail" error message when changing user password in Magento Admin (v 2.2.1)

texts:
I have a Magento 2.2.1 Running on a Amazon Lightsail VPS (the Bitnami Magento stack).

It has been working just fine, an previously I would get a "Password reset information" e-mail from the system whenever I tried to change the password of a user.

Now, however, if I try to set a new password, the page just reloads with an "Unable to send mail" error message being displayed at the top.

I'm using the SMTP App for Magento 2 plugin to handle mail, and when I go to Stores > Configuration > Advanced > System and test the mail set-up I successfully receive an e-mail from the system.

I have also verified that the e-mail addresses of the user accounts I am trying to reset the password for are valid.

UPDATE, I'm pasting the code from my _sendMail() function below.

    public function _sendMail()
{
    set_error_handler(array($this, '_handleMailErrors'));
    $result = mail(
        $this->recipients,
        $this->_mail->getSubject(),
        $this->body,
        $this->header);
    restore_error_handler();

    if ($this->_errstr !== null || !$result) {
        /**
         * @see Zend_Mail_Transport_Exception
         */
        #require_once 'Zend/Mail/Transport/Exception.php';
        throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);
    }
}


texts: Magento 2 : How to install new language pack

texts:
I am working on a Magento-2 website which is based on German language.

How to install and use new language package for German language in  Magento2.

Which package is best for German language?

Any one have an idea about it. Any help is really appreciated.


texts:
Im trying to get a list of items from an order to display correctly on my webpage using the SOAP API. I have managed to display shipping, billing and general info, and i have also managed to display the list of items... BUT for some reason i am getting duplicate results with a price and row_total equaling zero, the picture below shows what i mean:

So as you can see there are 2 records for ink_med and 2 for coal_sm, but only 1 record for the last entry.

My question to you guys is, how do i stop the duplicate records?

Here is the call im using to retrieve the order items:

$sales_order_info = $this->client->salesOrderInfo($this->sessionID,$o->increment_id);

And i access the items array by using this:

foreach($sales_order_info->items as $i)

Any help will be appreciated thank you


texts: Magento 2: How to connect Openbravo Erp with magento2

texts: Hello i want to connect my openbravo erp with magento2 website, there is any extension available if yes please suggest me


texts: Magento 2.3.4 - How to install Inventory Management Manually?

texts:
I am trying to install https://www.appjetty.com/magento2-magemob-inventory.htm, After installed the module during di:compile command i am getting the following error,

Class Magento\Inventory\Model\Source does not exist   Class
Biztech\Inventorysystementerprise\Controller\Mobileassistantpro\Product\addNewProduct\Interceptor
generation error: The requested class did not generate prop   erly,
because the 'generated' directory permission is read-only. If ---
after running the 'bin/magento setup:di:compile' CLI command when the
'generated' directory    permission is set to write --- the requested
class did not generate properly, then you must add the generated class
object to the signature of the related constru   ct method, only. Nov
9, 2020

I am installed my Magento using GitHub installation, Inventory files missing app/code/magento path, how to install manually.
Source: https://devdocs.magento.com/extensions/inventory-management/


texts: Magento 2: Call phtml file in static block or cms page

texts:
I would like to call a Magento phtml file to a static block I have a custom theme! How to do it, please?
here
/public_html/vendor/magento/module-catalog-search/view/frontend/templates/advanced/form.phtml

is where the phtml file is located
what should I do to call it ?
   /public_html/app/design/frontend/Emthemes/everything/shoppingcenter


texts: Check if product attribute exist/got value admin

texts:
I want to edit the template /app/design/adminhtml/default/default/template/sales/items/column/name.phtml

This so that I can add my own custom attribute to the sales order.
Therefore I created a line, that does work perfect for orders with products that still exists.

But when the order contains products that has been removed, the sales order does not load and the page breaks.

How can I change my line, so that it checks if the attribute value exists (or if the product still exists)?

CODE;

<?php $product_dpn = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku(), array('dpn'));
$product_mpn = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getSku(), array('mpn')); ?>

<?php if ($product_dpn->getDpn()): echo $product_dpn->getDpn(); endif; ?>

<?php if ($product_mpn->getMpn()): echo $product_mpn->getMpn(); endif; ?>


texts: SERIOUS HELP NEEDED removing "don't show this again" checkbox from newsletter {magento-2}

texts:
i want to remove the checkbox of "dont show this popup again" and do some change to display popup only one time.
currently, it is displaying every time i refresh the page to jump to another page.
here is the screen shot :

and here is the code from

  public_html/app/code/CleverSoft/Newsletter/view/frontend/templates/newsletter/

code:

                <input type="checkbox">

                <?php echo __('Don\'t show this popup again'); ?>

can someone please tell me how can i create cookie to restrict it to display only one time.
its poping up again and again after every refresh and on everypage.
please guide me what cookie code should i use.
i dont know much about using javascript.
need serious help here please dear seniors help me.


texts: Magento 2 Order State and Status Flow - Skip Invoicing and payments, so Shipped = Complete

texts:
I am doing a wholesale store which is used for order processing. No invoices are raised or required, it's a simple purchase order site, I'd like to skip invoices all together and have disabled the invoice emails, there will just be order copies, and when orders are shipped from the back end, they should be shown as complete.
I'm a bit puzzled on how to achieve this, Magento's work flow puts payment and invoicing before shipment. I'm sure there must be a clean way to do this in the back end with a custom state?
So for clarification, customer places an order, order may or may not be cancelled or edited by admin in the back end, but when it is logged as shipped it should be complete and no payments pending.


texts: Magento1.9 URL Issue for Duplicate Name Products

texts:
I am facing an issue where On my store more than 2 products have the same name things are going fine on a low range of products, As Magento will update URL on saving in the catalog_url_rewrite table if found same name products, and will allocate a free Path which is not in use.

But later we have found an issue that the URL is different in the table and when we open that product it will show different URL.

My table has some custom URLs as well, that is not generated by the system, that is generated by me.

I truncate the table and import the custom URL generated by me and do the reindexing so all the system generated URL will be created in the table.

But the issue remains the same.

Is there any way to check url key if already in the system so admin needs to update product name or key before save, As magento2.


texts: Magento 1.9 - Show Custom Attribute value after availability status on product detail page

texts:
Created a custom attribute and assigned it to all attribute set for Magento 1.9 Sample Data. I have set Visible on Product View page and Product Listing page to YES.

Assigned attribute value to product as shown below

The attribute value is shown under additional information on product details page. How do I show it as shown in below image using layout. Which block do I need to change ? My extension resides under app/code/local/


texts: Configurable Swatches in Magento 1.9.0.1

texts:
I added all the steps possible to make the configurable swatches functionality in the default theme of magento as per above answer link.

My Question is I have made all the steps in a correct way and the images replaced the drop-down in the product details page. But it is not replacing the text link to the images and also image switch over is not working.!

Not working in layered navigation and showing only the text links instead of image swatches.


texts: Add subscriber status to flat order grid

texts:
I'm trying to add subscriber status to sales_flat_order_grid. I already got postcode working, but now I'm kind of stuck. This is what I've tried so far:

startSetup();

// Add column to grid table
$this->getConnection()->addColumn(
    $this->getTable('sales/order_grid'),
    'postcode',
    "varchar(255) not null default ''"
);
$this->getConnection()->addColumn(
    $this->getTable('sales/order_grid'),
    'subscriber_status',
    "int(4) not null default 0"
);

// Add key to table for this field,
// it will improve the speed of searching & sorting by the field
$this->getConnection()->addKey(
    $this->getTable('sales/order_grid'),
    'postcode',
    'postcode'
);
$this->getConnection()->addKey(
    $this->getTable('sales/order_grid'),
    'subscriber_status',
    'subscriber_status'
);

This works fine, it adds the columns to the sales_flat_order_grid table. Now I need to fill the newly added columns, like this:

// Now you need to fullfill existing rows with data from address table
$select = $this->getConnection()->select();
$select->join(
    array(
        'address' => $this->getTable('sales/order_address'),
    ),
    $this->getConnection()->quoteInto(
        'address.parent_id = order_grid.entity_id AND address.address_type = ?',
        Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
    ),
    array('postcode' => 'postcode')
)->join(
    array('subscriber' => $this->getTable('newsletter_subscriber')),
    $this->getConnection()->quoteInto(
        'subscriber.subscriber_email = address.email AND address.address_type = ?',
        Mage_Sales_Model_Quote_Address::TYPE_SHIPPING
    ),
    array('subscriber_status' => 'subscriber_status')
);

$this->getConnection()->query(
    $select->crossUpdateFromSelect(
        array('order_grid' => $this->getTable('sales/order_grid'))
    )
);

But unfortunately it doesn't work, the column gets added, but they don't get filled. Can someone get me back on track? I got no errors, except that the transaction gets locked.


texts: Magento 2 is not inserting into "quote_shipping_rate" table?

texts:
I have done my homework and I know what the problem is with my website, but I don't know how to solve it
The Symptoms
When a new user clicks on place order, he receives an empty error message preventing him from proceeding. see the image below

The fact that it happens only to new users tells me that this is a recent problem but I don't remember what has changed since.
The Error
The error that I see in the apache log after this happens is the following:
PHP Fatal error:  Uncaught Error: Call to a member function getCarrier() on boolean in /var/www/public/vendor/magento/module-checkout/Model/PaymentInformationManagement.php:119
Stack trace:
#0 /var/www/public/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Checkout\\Model\\PaymentInformationManagement->savePaymentInformation(1, Object(Magento\\Quote\\Model\\Quote\\Payment\\Interceptor), Object(Magento\\Quote\\Model\\Quote\\Address\\Interceptor))
#1 /var/www/public/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Checkout\\Model\\PaymentInformationManagement\\Interceptor->___callParent('savePaymentInfo...', Array)
#2 /var/www/public/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Checkout\\Model\\PaymentInformationManagement\\Interceptor->Magento\\Framework\\Interception\\{closure}(1, Object(Magento\\Quote\\Model\\Quote\\Payment\\Interceptor), Object(Magento\\Quote\\Model\\Quote\\Address\\Interceptor))
#3 /var/www/public/generated/code/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.ph in /var/www/public/vendor/magento/module-checkout/Model/PaymentInformationManagement.php on line 119

The Problem
After extensive debugging, I have identified the problem as that Magento 2 is no longer saving new rows to the table quote_shipping_rate. That's why existing customers who already have their records saved in this table are able to checkout with no problem. But for new customers (or guests) this problem occurs.
I don't know where Magento 2 is supposed to insert new records in this table even after debugging (I'm using XDebug) and I don't know what causes it to stop inserting the new records.
Any Help will be highly appreciated.
The list of all modules and extensions I have can be found here: https://pastebin.com/u1uigaSL
(Magento version is 2.2.8)


texts: Magento 2 Product Collection add array as column for sorting

texts:
I've requirement like following.

Products price is calculated on the fly and I want price sorting to be proper with it.

I've extend the block Magento\Catalog\Block\Product\ListProduct

Following is code

protected function _getProductCollection()
    {
        $sortingOrder =  $this->getToolbarBlock()->getCurrentOrder();
        $sortingDirection = $this->getToolbarBlock()->getCurrentDirection();
        $collection = parent::_getProductCollection();

        if ($collection != null && $sortingOrder == 'price') {
            $list = array();
            $templist = array();
            foreach ($collection as $k => $product){
                $newPrice = $product->getPrice();
                $list[] = array('sku'=>$product->getSku(),'newprice'=>$newPrice);
            }
            foreach ($list as $v){
                $templist[] = "SELECT {$v['sku']} as newsku, {$v['newprice']} as newprice";
            }
           $newsql = implode(' UNION ', $templist);
            $selectTwoSql =$collection->getSelect()->__toString();

            $collection->getSelect()->reset();
            $collection->getSelect()->union(array(
                new \Zend_Db_Expr($selectTwoSql),
                new \Zend_Db_Expr($newsql),
            ));

            echo $collection->getSelect();
            die;
        }

        return $collection;
    }

In above code I've tried to create columns in collection.

My query o/p is as following

SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `stock_status_index`.`stock_status` AS `is_salable`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='38' INNER JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 1 AND stock_status_index.stock_id = 1 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 INNER JOIN `search_tmp_5cf5a6d29872b5_06618402` AS `search_result` ON e.entity_id = search_result.entity_id WHERE ((stock_status_index.stock_status = 1)) AND (e.created_in <= '1552348800') AND (e.updated_in > '1552348800') ORDER BY `price_index`.`min_price` asc, `e`.`entity_id` DESC LIMIT 12 UNION SELECT 10304703 as newsku, 66.0000 as newprice UNION SELECT 10212044 as newsku, 66.0000 as newprice UNION SELECT 10212016 as newsku, 76.0000 as newprice UNION SELECT 10212014 as newsku, 76.0000 as newprice UNION SELECT 10212013 as newsku, 76.0000 as newprice UNION SELECT 10304694 as newsku, 104.0000 as newprice UNION SELECT 10362088 as newsku, 90.0000 as newprice UNION SELECT 10382742 as newsku, 99.0000 as newprice UNION SELECT 10382741 as newsku, 99.0000 as newprice UNION SELECT 10362089 as newsku, 90.0000 as newprice UNION SELECT 10269385 as newsku, 227.0000 as newprice UNION SELECT 10383265 as newsku, 204.0000 as newprice

After executing query in phpmyadmin, I'm not getting newsku and newprice column.

I want the collection to be sorted based on newprice which is created on the fly.

Maybe I'm following wrong way but this price data are not being saved anywhere else so I'm left with no choice but to calculate like this.

Can anyone please guide me?


texts:
Which way do you reset magento orders?

For example, now the current order - # 100000051.

I need:

1) completely remove all orders from the Database
2) new order will have to start with a number # 100000001 (this is important)

Please let us know your trusty and checked up way!
Thank you!


texts:
I'm trying to make the Canadians taxes rules working.
I already did all the taxe rates...
But, of course the tax rules are not working...
I can see only the default Canadian tax 5%.

For example in Quebec I should see: 5% + 9.9750


texts: How to hide 0 when using {{var order.increment_id}} in an email or PDF invoice?


texts:
I use following code to call rest api in magento 2.1.5

    $consumerKey = 'aca1rh9env59axm0ob48xfu62t9s4a5e';
    $consumerSecret = 'dgn4y1ejfu9aixb5mrio4kbsor5tq208';
    $accessToken = 'fi5keosdaod7hgqsyhv9i8o2yxvk0dqx';
    $accessTokenSecret = 'ugeovkdcyvl3q2wc0kxjmgiprobtr63g';

    $method = 'GET';
    $url = 'https://dev.devserver.com/index.php/rest/V1/customers/1';

    $data = [
        //'searchCriteria' => '',
        'oauth_consumer_key' => $consumerKey,
        'oauth_nonce' => md5(uniqid(rand(), true)),
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_timestamp' => time(),
        'oauth_token' => $accessToken,
        'oauth_version' => '1.0'
    ];

    $data['oauth_signature'] = $this->sign($method, $url, $data, $consumerSecret, $accessTokenSecret);

    $curl = curl_init();

    curl_setopt_array($curl, [
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_SSL_VERIFYHOST => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => $url,
        CURLOPT_HTTPHEADER => [
                'Authorization: OAuth ' . http_build_query($data, '', ',')
        ]
    ]);

    $result = curl_exec($curl);
    curl_close($curl);
    var_dump($result);

    public function sign($method, $url, $data, $consumerSecret, $tokenSecret)
    {
        $url = $this->urlEncodeAsZend($url);

        $data = $this->urlEncodeAsZend(http_build_query($data, '', '&'));
        $data = implode('&', [$method, $url, $data]);

        $secret = implode('&', [$consumerSecret, $tokenSecret]);

        return base64_encode(hash_hmac('sha1', $data, $secret, true));
    }

    public function urlEncodeAsZend($value)
    {
        $encoded = rawurlencode($value);
        $encoded = str_replace('%7E', '~', $encoded);
        return $encoded;
    }

Everything works fine in this case. But if i change url to somethinf like this https://dev.devserver.com/index.php/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=category_id&searchCriteria[filter_groups][0][filters][0][value]=10

i got error: invalid signature. Can anyone help with this?


texts: Magento redirecting to login page to user after SSL activated ( if get http request code 301 )

texts:
Recently I am facing very strange problem.

After activating SSL for frontend sometimes user is redirected to login page after click on regular page even from homepage.

As I follow method provided by 'rxt' Here is my conclusion.

Magento redirecting to login page if get HTTP 301 response code.

How I can overcome this problem?


texts: Patch SUPEE-6788 - Customer register template Hunk FAILED

texts:
With our Magento version 1.9.1.0 when we are trying to apply patch via SSH it fails with following error

Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file app/design/frontend/base/default/template/customer/form/register.phtml.rej
patching file app/design/frontend/base/default/template/customer/form/resetforgottenpassword.phtml
Hunk #1 FAILED at 28.
1 out of 1 hunk FAILED -- saving rejects to file app/design/frontend/base/default/template/customer/form/resetforgottenpassword.phtml.rej

What should be the issue? if I am going to replace the files with default Magento installation will it will then cause issues if these were modified earlier?


texts: Show VAT Number on Sales Order View Shipping Address Magento 1.9

texts:
I'm using One step Checkout for Magento 1.9.4 and I'm trying to show Vat number on admin shipping address order view. But I couldn't achieve this. I tried to add
{{depend vat_id}}VAT: {{var vat_id}}{{/depend}}

in Address template in Customer Configuration without success. I think One Step Checkout is using another field to filling Vat Number. How can I achieve this?


texts: Getting website configuration from Magento 2 by passing in config field and website Id

texts:
How can I fetch Magento website configuration information by passing in a customers website_id.

I know how to load configuration for a store but in this instance I want to get the configuration information from the website that the customer is attached to for exporting to a ERP system where customers for a website are grouped together in customer groups.


texts: Magento admin login redirects to Magento Connect Manager

texts:
After I login to the magento admin panel I am redirected to the Magento Extension Manager login screen.

Once I login to the magento extension manager I am not able to reach the admin panel despite clicking on the Return to Admin link.

Can anyone help me with this?


texts: Adding multiple JS files in Magento 2 using requirejs via custom theme

texts:
I have successfully added one js file using requirejs-config.js.

Code in requirejs-config.js

var config = {
    //when load requirejs will load following files also
    deps: [
        "js/main" //path to our main.js file. .js extension is not required.
    ]
}

Code in main.js

define([
        "jquery"
    ],
    function($)
    {
        "use strict";

        //our code goes here..
        console.log(" ====== Coming from Ved>Mytheme>Magento_Theme>web>js>main.js ====== ");

    }//main function ends here
);

But now I want to add multiple JS files:

modernizer.js
vendor.js [ This contains all 3rd party js. For ex. jQuery fancybox, flexslider, etc. ]
main.js [ This is already added but this should include after vendor.js ]

All above js files are present at:
vendor_name/theme_name/Magento_Theme/web/js


texts:
I'm probably the last poblem with my shop . I have 5 in stock products "TEST" . I see them in the store, but I can not change their status from "OUT OF STOCK " on the other. By this I do not buy the product test to see how it works. How can I do this?
And how can set the ability to order things from outside the store ?


texts: Cart is cleared or customer logged out after coming from payment gateway

texts:
We've PayTabs payment gateway, Post successful payment customer cart is getting logged out.
I saw this is happening is chrome 80+ because of samesite cookie.
I tried Magento patch MDVA-25602 through MQP but that's not solving problem.
Does anyone faced this problem and have any suggestion ?
Any help would be helpful.


texts: How to modify default footer links in Magento 2?

texts:
Magento 2.1.9

I want to change the privacy policy link text, it's located at,

Privacy-cookie: magento2/vendor/magento/module-cms/view/frontend/layout/default.xml

If I edit it there, it works fine. However we all know you don't edit core files, so I copied the file to my custom theme,

magento2/app/design/frontend/custom_vendor/custom_theme/module-cms/view/frontend/layout/default.xml

However the changes aren't being loaded. Where is the correct place in my custom theme to put default.xml so that it overrides the magento default one?


texts:
I want to print total paid and total due in the invoice and shipment pdf in magento.

i can now able to print subtotal tax and grand total

please help me


texts: ORDERS not showing as an Entity in Export function

texts:
Per this article, I should be able to export Order details...
http://www.magentocommerce.com/knowledge-base/entry/how-to-export-orders

However, when I go to the Export function ORDERS is not in the list of selections to export.  The only selections I get to choose from in the Export function is PRODUCTS or CUSTOMERS.

Can you tell me how I can ORDERS as an export option?


texts: Magento 2 Rest API - how do I add values to dropdown product attribute

texts:
I have problems in adding values to an existing product attribute, using the API POST /products/attributes/:attribute_id/options.
The corresponding GET API is working fine, as explained below.

I have defined a drop down product attribute in my store and I am trying to add values using Rest API.

I am able to retrieve the current values of the attribute with this GET call:

http://50.50.50.50/index.php/rest/V1/products/attributes/135/options

And I get, as expected, this result:

[
  {
    "label": " ",
    "value": ""
  },
  {
    "label": "Coffe",
    "value": "4"
  },
  {
    "label": "Tea",
    "value": "5"
  }
]

Then I try to add a new value with this POST call:

http://50.50.50.50/index.php/rest/V1/products/attributes/135/options

Passing the following value:

{
  "option": {
    "label": "Cappuccino",
    "value": "6"
  }
}

The response is: true

But if I repeat the first call, in order to get the new list of values, the new value is not added. I have tried to refresh all the caches and also restarted the server, but nothing have changed.

What I am doing wrong ?

Magento version is 2.1.5

Thanks,
Nick.


texts: How to add an Image element for the new PageBuilder content-type in Magento2?

texts: I have created a new content-type for PageBuilder following the documentation here https://devdocs.magento.com/page-builder/docs/create-custom-content-type/overview.html, the content-type is Example_PageBuilderQuote , however all the elements added in thare textarea, input and select it doesn't show you how to add an image element, I would like to add for example for this PageBuilderQuote module, an image element to show the quote_author_image, but I can't find how to do it in the documentation, can someone help please?


texts:
We have a Linux CentOS 7 server with PHP 7.0.9 and NGINX 1.11.3 installed.
We have completed the command line installation of Magento 2.1.0.
The front end loads up just fine in the browser but when I try to go to the admin back end, I am getting a 404 error page.
I have been scouring the internet for a solution and none of the solutions I have found have fixed my issue.
Please help!

Thanks


texts: Redirect root page to specific store (language) view

texts:
We setup a Magento 2 Shop with 3 languages:
Www.domain.com/de_ch/
Www.domain.com/fr_ch/
Www.domain.com/en_ch/
Where de_ch is the default language.
The problem now is, that we get duplicate content for www.domain.com and www.domain.com/de_ch/
How can we permanently redirect www.domain.com to www.domain.com/de_ch/ ?
Or is there another approach to omit the duplicate pages for search engines?
Thanks
Aldo


texts: Custom form template - yesno select box html

texts:
Is it possible either in a block or template (adminhtml) to render a yes/no select box directly?

Without having to get the option array first and then build the select manually?

I would have thought there be an existing method somewhere that does this but I can not find it.


texts: How do you re-install only the magento default mysql database, tables and data?

texts:
I was working through a problem with mysql and eventually purged it and reinstalled it on the system. Now magento db and all related tables are gone. How can I re-install the original database and tables and records without re-installing everything and losing custom php/JS code changes?

I'm working with magento2 on Ubuntu 16.04


texts: Magento 2 debugging js ui component in browser

texts:
As i am searching debugging of ui component i don't find any great articles to debugging ui component in browser console so here i am writing my question.

As we all know magento current system is using knockout js, so i found this link
https://devdocs.magento.com/guides/v2.2/ui_comp_guide/troubleshoot/ui_comp_troubleshoot_js.html but i don't understand how it is work.

As per magento officials doc we can debug data as below link content.
https://devdocs.magento.com/guides/v2.2/ui_comp_guide/concepts/ui_comp_uiregistry.html

But as above link you have to know about your componentName for debugging it's data.

But my main concern is if i am currently accessing any custom module or core module form and I want to debug that form data from console then how ? because I don't know it's form namespace and it's tedious to find form namespace from element tab.


texts: Virtual host setup in local host magento 2

texts: I installed magento 2.2.4 and (name directory SA ) i want to have  in the url sa.com.tn and for admin sa.com.tn/interBO/admin so i tried to open sudo vi /etc/apache2/sites-available/magento2.conf but it is  empty so how to do that and why this file is empty. please i need your help


texts: Magento 2.1.15: Compilation error: Class Magento\Framework\Serialize\Serializer\Json does not exist

texts:
I did the following command on the CLI of a Magento 2.1.15 installation:

php bin/magento setup:di:compile -vvv

The following exception occurred:

[RuntimeException]
  Class Magento\Framework\Serialize\Serializer\Json does not exist

And in deep:

Exception trace:
 () at /html/magento2/vendor/magento/framework/Code/Generator.php:115
 Magento\Framework\Code\Generator->generateClass() at /html/magento2/setup/src/Magento/Setup/Module/Di/Code/Generator.php:70
 Magento\Setup\Module\Di\Code\Generator->generateList() at /html/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Operation/Interception.php:100
 Magento\Setup\Module\Di\App\Task\Operation\Interception->doOperation() at /html/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 Magento\Setup\Module\Di\App\Task\Manager->process() at /html/magento2/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:188
 Magento\Setup\Console\Command\DiCompileCommand->execute() at /html/magento2/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /html/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /html/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /html/magento2/vendor/magento/framework/Console/Cli.php:125
 Magento\Framework\Console\Cli->doRun() at /html/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /html/magento2/bin/magento:23

Now I would like to go hunting for the error, but the files all seem OK and I really do not know what to try next. Is there any idea?


texts:
Hello I would like to make changes in my Magento template product listing page right now it displays the image only and i want to write the text after the image.

I tried to edit in view.php file but its not working for me.

Here i am attaching the picture what exactly i want.


texts: Magento 2: The value of attribute “is_new” must be set

texts:
Whenever I try to save a category I get The value of attribute "is_new" must be set. How can I solve that?
This issue occur after update magento version from magento 2.0.9 CE to magento 2.1.1 CE.

Thanks!


texts: How do I give multiple users access to Magento 2 on local host

texts:
I have deployed Magento2, phpmyadmin and XAMPP on a dedicated localhost server running WIndows 10. Everything is working fine and I have uploaded my entire catalogue etc.

I want to give other members of my team access to Magento 2 so they can familiarise themselves with it before I deploy to a production environment.

What is the process I need to go through to give them access once I have edited their permissions?


texts: Date Validation not working ( conflict with Date Picker )

texts:
Following issue wiht 1.8 CE:

When I’m trying to save CMS custom design info:

Custom Design From
Custom Design To

The validation fails ( even if dates are correct )

I’m trying with chrome
I have tried to change switch my locale (english/italian) but same issue

The root of the problem looks to be the following one:

Date picker fill dates in the format DD/MM/YYYY but validator.js (line 503) fail to create the new date(v) obj.
It looks like date(string) accept only date in the English/American format (MM/DD/YYYY)

Any idea how to fix this ?

I'm looking for a workaround as I'm developing an extension ...

Reference:

Inchoo: Magento: Date format troubles

Update

Some code may help to understand the scenario:

 $dateFormatIso = Mage::app()->getLocale()->getDateFormat(
        Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
    );

    $fieldset->addField('date_from', 'date', array(
        'name'      => 'date_from',
        'label'     => Mage::helper('myhelper')->__('Date From'),
        'image'     => $this->getSkinUrl('images/grid-cal.gif'),
        'format'    => $dateFormatIso,
        'class'     => 'validate-date validate-date-range date-range-date-from'
    ));

    $fieldset->addField('date_to', 'date', array(
        'name'      => 'date_to',
        'label'     => Mage::helper('myhelper')->__('Date To'),
        'image'     => $this->getSkinUrl('images/grid-cal.gif'),
        'format'    => $dateFormatIso,
        'class'     => 'validate-date validate-date-range date-range-date-to'
    ));


texts: Magento 2: How to remove js included with requirejs-config.js

texts: Is it possible to How to remove the js file that was included using requirejs-config.js


texts: save admin form and redirect back url in magento 2.3

texts:
I have create admin sales grid. All is working fine.
And i have added one link in order view page.
This link click redirect custom admin form.
And Finally i want to save custom admin form. And  redirect order view page backurl
View edit link in order view section :-

And then click edit link go to custom admin form.And custom admin form save after redirect order view page.
Order view page URL :- http://127.0.0.1/mag233/admin/sales/order/view/order_id/2/
Custom admin form URL :- http://127.0.0.1/mag233/admin/editfrom/index/index/order_id/2/

And then custom admin form save after come back order view page.

Here is my save controller code :-
<?php

namespace LR\Adminsalesgrid\Controller\Adminhtml\Index;

use Magento\Backend\App\Action;
use LR\Adminsalesgrid\Model\Lr;
use \Magento\Framework\Controller\ResultFactory;

class Save extends \Magento\Backend\App\Action
{
    protected $Custommodel;

    public function __construct(
        Action\Context $context,
        Lr $Custommodel
    ) {
        parent::__construct($context);
        $this->Custommodel = $Custommodel;
    }

    public function execute()
    {
        $data = $this->getRequest()->getPostValue();

        if ($data) {
            $id = $this->getRequest()->getParam('id');

            if ($id) {
                $this->Custommodel->load($id);
            }

            $this->Custommodel->setData($data);

            try {
                $this->Custommodel->save();
                $this->messageManager->addSuccess(__('The data has been saved.'));
                $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
                $resultRedirect->setUrl($this->_redirect->getRefererUrl());

                return $resultRedirect;
            }catch (\Exception $e) {
                $this->messageManager->addException($e, __('Something went wrong while saving the data.'));
            }

            return $resultRedirect->setPath('*/*/edit', ['id' => $this->getRequest()->getParam('id')]);
        }
        return $resultRedirect->setPath('*/*/');
    }
}

Please advice me what is actually problem.
THANKS.


texts: Maximum QTY allowed in shopping cart error

texts:
When I set a product to have a maximum allowed in cart to 10 and test on the website the cart won't allow more than 10. But if I add more than 10 - say 30 you cannot checkout but the individual price and total price shows a reduction.

Example product priced at 15.99 when you add 30 the price shows as 1.24 each.

Any ideas?


texts:
Magento/catalog/product/price/amount/default.phtml

I have override above default.phtml file after that i couldn't able to display exclusive tax on product view page as well as category list page in Magento 2.

I have also set price display setting tax inclusive, exclusive both.

    <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <block class="Magento\Framework\Pricing\Render\RendererPool" name="render.product.prices">
        <arguments>
            <argument name="default" xsi:type="array">
                <item name="default_render_class" xsi:type="string">Magento\Catalog\Pricing\Render\PriceBox</item>
                <item name="default_render_template" xsi:type="string">Magento_Catalog::product/price/default.phtml</item>
                <item name="default_amount_render_class" xsi:type="string">Magento\Framework\Pricing\Render\Amount</item>
                <item name="default_amount_render_template" xsi:type="string">Namespace_Module::catalog/product/price/amount/default.phtml</item>
                <item name="prices" xsi:type="array">
                    <item name="special_price" xsi:type="array">
                        <item name="render_template" xsi:type="string">Magento_Catalog::product/price/special_price.phtml</item>
                    </item>
                    <item name="tier_price" xsi:type="array">
                        <item name="render_template" xsi:type="string">Magento_Catalog::product/price/tier_prices.phtml</item>
                    </item>
                    <item name="final_price" xsi:type="array">
                        <item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\FinalPriceBox</item>
                        <item name="render_template" xsi:type="string">Magento_Catalog::product/price/final_price.phtml</item>
                    </item>
                    <item name="custom_option_price" xsi:type="array">
                        <item name="amount_render_template" xsi:type="string">Magento_Catalog::product/price/amount/default.phtml</item>
                    </item>
                    <item name="configured_price" xsi:type="array">
                        <item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\ConfiguredPriceBox</item>
                        <item name="render_template" xsi:type="string">Magento_Catalog::product/price/configured_price.phtml</item>
                    </item>
                </item>
                <!--<item name="adjustments" xsi:type="array"></item>-->
            </argument>
        </arguments>
    </block>
</layout>

My Module default.phtml

  Magento/catalog/product/price/amount/default.phtml

Even if i had copy this default.phtml file code to my module file but still its not working at all. Take a look at this screenshot.
http://prntscr.com/jl2a6r

The actual output i want.
http://prntscr.com/jl2b1r

Thanks in advanced :)


texts: Trying to add "disabled='disabled'" to a select option on an adminhtml form - 1.9.0.1 CE

texts:
I have an array of all regions and a collection of all currently "used" regions which are assigned to my entity.  I would like the select box to show all regions, but the ones that are currently "used" will be disabled.  I'm hoping there's a way to do this, and I don't have to resort to JS.

Part of the form in which I need disabled options:

'remainingRegions' => array(
            'label' => $this->__('Remaining Regions'),
            'input' => 'select',
            'required' => false,
            'values' => Mage::helper('dos')->GetRemainingRegions((int)$origin->getEntityId()),
        )

Here is GetRemainingRegions():

    public function GetRemainingRegions()
{
    $regionArray = array();
    $allAssignedRegions = Mage::getResourceModel('dos/states_collection')->load()->getItems();
    $allRegions = $this->GetRegions(FALSE);

    if(count($allAssignedRegions))
    {
        foreach($allRegions as $key => $region)
        {
            if(array_key_exists($region['value'],$allAssignedRegions))
            {
                unset($allRegions[$key]);
            }
        }
    }

    $regionArray = $allRegions;

    return $regionArray;
}


texts: How to Override Extension's Plugin Class

texts:
I would like to override the Plugin class of an extension I'm using on Magento 2 as there are too many bugs in it, and I just want to rewrite the file in my module.

How can I do this?

First I tried adding this to my module's di.xml.

<type name="Magento\SalesRule\Model\Rule\Metadata\ValueProvider">
    <plugin name="Amasty_Promo::SalesRule_ValueProvider" type="Holy\AmastyPromo\Plugin\ValueProvider" />
</type>

But this just trow's this exception eventhough I have created the app/code/Holy/AmastyPromo/Plugin/ValueProvide.php file.

  Exception #0 (InvalidArgumentException): Plugin class
  Holy\AmastyPromo\Plugin\ValueProvider doesn't exist

Not sure what else to do, should I take a different approach?


texts: Programatically created user - wrong password when logging in?

texts:
I have to make a cron job that once a day creates users from a file on the server. The script works fine, but, the users it generates can't log in (only local for now, not live).

Here is the code:

$customerFactory = $objectManager->get('\Magento\Customer\Model\CustomerFactory');

$customer = $customerFactory->create();
$customer->setWebsiteId($websiteId);
$customer->setMediqCustomerId($mediqId);
$customer->setEmail($email);
$customer->setFirstname($name);
$customer->setPassword('Password123');
$customer->save();

Any ideas what I'm doing wrong? When trying to log in with user created with this, it says that the password is wrong.

PS I know not to use OM like this. I just wanted to test if I can even make users in code like this.

Any help is more than welcome. Thanks.


texts: How to add grid in magento admin form using custom Field type?

texts:
I am trying to add a grid in my admin form tab. the idea is that the top part of page will hold  the form and the bottom part will have the grid.

example of it is:

I obtained the instructions on how to do this from
here

In summary I added a renderer via the $fieldset->addType to  my form.

The form rendered okay, but no grid.

example code

  $fieldset->addType('customer_grid',
  'test_testmodule_Block_Adminhtml_config_Edit_Form_Renderer_Fieldset_config');

i.e

class test_testmodule_Block_Adminhtml_config_Edit_Tab_config extends Mage_Adminhtml_Block_Widget_Form
{
    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $this->setForm($form);

        # add a fieldset, this returns a Varien_Data_Form_Element_Fieldset object
        $fieldset = $form->addFieldset('base_fieldset', array(
            'legend' => Mage::helper('test_testmodule')->__('test')
        ));

      $fieldset->addType('customer_grid',
> 'test_testmodule_Block_Adminhtml_config_Edit_Form_Renderer_Fieldset_config');

   .......Form Fieldsets

         return parent::_prepareForm();
    }

I then created a page for creation of form grid.

    public function getElementHtml()
    {
        return Mage::helper('core')->getLayout()->createBlock('test_testmodule/adminhtml_payment_edit_form_renderer_fieldset_config_grid')->toHtml();
    }
}

FINALLY

I created the grid page.

<?php
class test_testmodule_Block_Adminhtml_config_Edit_Tab_config_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

    public function __construct()
    {
        parent::__construct();
        $this->setId('customerGrid');
        $this->setUseAjax(true);
        $this->setDefaultSort('entity_id');
        $this->setSaveParametersInSession(true);
    }

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

    protected function _prepareColumns()
    {
    ..........collection values
    }

}

I suspect the problem is from the $fieldset->addType - it is simply not rendering the block


texts: menu.js:1 Uncaught TypeError: require is not a function

texts:
I am trying to add a jquery script to my site. I have updated the require-config so it has this-

var config = {
paths: {
    slick: 'js/slick.min',
    slaask: 'js/customscript',
    menu: 'js/menu.js'
},
shim: {
    slick: {
        deps: ['jquery']
    },
    menu: {
        deps: ['jquery']
    }
}
};

The script looks like this-

require(['jquery'], function($) {
$(document).ready(function () {
    // Collapsible Menu
    function accordion(trigger) {
        //variables
        var $button = $(trigger);//trigger firing the event
        //visible = true;//flag for wayfinding

        $button.hover().css({'cursor': 'pointer'});

        //event
        $button.click(function () {

            //conditional check
            if ($(this).find('.panel-content').css('display') == 'none') {
                $button.removeClass('active');
                $('.panel-title .icon').html('&oplus;');

                $(this).next().slideUp('slow', function () {
                    $(this).addClass('visuallyhidden').slideDown(0);
                    $('.panel-content').attr('aria-expanded', 'false');
                });

            } else {
                if ($(this).hasClass('active')) {
                    $('.panel-title.active .icon').html('&oplus;');
                    $('.panel-title.active').next().slideUp('slow');
                    $('.panel-title.active + .panel-content').attr('aria-expanded', 'false');
                    $('.panel-title.active').removeClass('active');
                }
                else {
                    $('.panel-title.active .icon').html('&oplus;');
                    $('.panel-title.active').next().slideUp('slow');
                    $('.panel-title.active + .panel-content').attr('aria-expanded', 'false');
                    $('.panel-title.active').removeClass('active');

                    $button.addClass('active');
                    $('.panel-title.active .icon').html('&otimes;');

                    $(this).next().slideUp(0, function () {
                        $('.panel-content').attr('aria-expanded', 'true');
                        $(this).removeClass('visuallyhidden').slideDown('slow');
                    });
                }
            }

            //flag dude

            return false
        });
    }

    //call to widget trigger1
    accordion('#trigger1');
    //call to widget trigger2
    accordion('#trigger2');
    //call to widget trigger3
    accordion('#trigger3');

});//end document.ready()
});

The error I am getting is-

Uncaught TypeError: require is not a function
    at menu.js:1

Why am I getting that error?


texts: Magento 1.7 Checkout Page Not Working Properly

texts:
Hello everyone I have a issue that I can not pin point at this time.

I am running magento at http://mytempsite.net/gotie and then have a wholesale store setup on the same installation at http://mytempsite.net/gotie/wholesale.

The issue is when I go to checkout on mytempsite.net/gotie when I click proceed to check out it goes to the next page but I am not able to move past the "Checkout as Guest, Register or Login Page" If i try loggin using an existing test account it loads the next step but under billing information there is absolutely nothing (Test Login: admin@admin.com pass: hayden927 )

But when I go to the wholesale site mytempsite.net/gotie/wholesale and add a product to cart I am able to go through all the steps just fine. You will need to login to see the catalog using the following information (Test Login: nick@nick.com pass: hayden927 )

What I have Tried
I have tried disabling all 3rd party plugins and modules.

List of 3rd Party Modules That Came with Theme?
Amasty Improved Navigation
Itoris Registration Fields (Wholesale Site)
Netzarbeiter Customer Activation (Wholesale Site)
Netzarbeiter Login Catalog (Wholesale Site)

List of 3rd Party Modules I installed
Phoenix Money Bookers
Webdziner Ajax Search
Webdziner All
Webdziner Bgsetting
Webdziner New Product


texts: Magento 2 override module-ui from custom theme

texts:
Is there any option to override magento-ui  vendor/magento/module-ui/view/base/web/templates templates from a theme?

Other module's templates overriding works fine:

var config = {
    map: {
        '*': {
            'Magento_Checkout/template/estimation.html': 'template/module-checkout/estimation.html',
            'Magento_Checkout/template/progress-bar.html': 'template/module-checkout/progress-bar.html'
        }
    }
};

But I see that module-ui templates' path is declared this way:

var config = {
    paths: {
        'ui/template': 'Magento_Ui/templates'
    }
}

And I can't override this file:

  vendor/magento/module-ui/view/base/web/templates/form/element/textarea.html


texts: Get Only Cusomer ID from DB, better way?

texts:
I am trying to login a customer automatically on the basis of a custom attribute which I get from my URL. To auto login the customer, I get the ID of customer first and then use to login the user. But as I am start to learn more about Magento, I can see in my code that my query to get customer detail will fetch all details about the customer as a collection, and the collection will be huge and might also create memory leaks. Can anyone please suggest me how to keep it optimized, I have been searching but have not found anything yet.

    $customer = Mage::getModel('customer/customer')
            ->getCollection()
            ->addAttributeToSelect('entity_id')
            ->addAttributeToFilter('website_id', WEB_ID)
            ->addAttributeToFilter('custom_attribute', $custom_attribute)
            ->load();

    if (is_object($customer)) {
        $customer_data = $customer->getData();
        Mage::getSingleton('customer/session')
              ->loginById($customer_data[0]['entity_id']);
        }

  Should I go for core MySql query to fetch the entity_id, because the above fetches a lot of data.


texts:
It all started when we moved the site and the email sending to a new server. Since then the new sale emails are sent twice, both to the customer and store owner. We are running Magento ver. 1.9.2.4

I tried out all the solutions described here, here and here.

Here is what I know so far:

there are no orphan records left on the Recipients table
there are no duplicate emails created in the database
cron is running and there are no duplicate crontasks created
I have set the copy that is sent to the store to BCC, I tried the Separate copy method but it's the same issue
Initially we used SMTP pro extension, as it was required by the old host company, the issue started when I changed these settings to the new server's settings. I disabled and uninstalled the extension, but it keeps sending duplicate emails.
There is a little difference between the two emails:

visually the payment method is missing from one the emails
comparing the two sources I found the following differences in the head section:

2: Received: by 10.25.25.18 with SMTP id 18csp557327lfz;
3: Thu, 9 Jun 2016 14:08:03 -0700 (PDT)
4: X-Received: by 10.140.96.199 with SMTP id k65mr9670671qge.27.1465506483853;
5: Thu, 09 Jun 2016 14:08:03 -0700 (PDT)

2: Received: by 10.25.25.18 with SMTP id 18csp557131lfz;
3: Thu, 9 Jun 2016 14:07:25 -0700 (PDT)
4: X-Received: by 10.140.85.106 with SMTP id m97mr11482818qgd.41.1465506445409;
5: Thu, 09 Jun 2016 14:07:25 -0700 (PDT)

8: by mx.google.com with ESMTPS id s5si4428297qkc.169.2016.06.09.14.08.03
8: by mx.google.com with ESMTPS id v124si1449328qhc.120.2016.06.09.14.07.24

16: Message-Id:
<5759dab3.0577370a.5244e.45daSMTPIN_ADDED_MISSING@mx.google.com>

16: Message-Id:
<5759da8d.82fa8c0a.780ba.ffff8a35SMTPIN_ADDED_MISSING@mx.google.com>

23: bh=dkKnBT4pJtbsDHYzbIX730M5P1u+x/BPP7K3dCdYeCE=; b=bKu0SmXGmuiU2GyuQbIcrR7OSH CRfnmNgcu8fGMu2ep8IEisxwyUQfFqLr7u+Exv7MBqtinYdTgFs1C6RuPJUJoEDKDLQAgd6tz3Joe O5UObhunwfkEj1r8hLQofHr0ohyq8aaCGwAe2QP6pJaIAaLhouo2Otwq/e/KnHL7Xt77D6HYKFyr8 ep3MBAVnRld4dBVN0InxOa1L3IACKFwn2x5nHsxvoxYot5+ECkfOsKGSkL7p/LHs4VLhTL1CE4BoI wk3r0u5WL7FRFWaHJyKp8Ey5ZNOvtdY0/bU9jgCOyuXLEmPbyuobGMXFHbUwjDKv8LD0OAjlqY7eZ Ai1YUnTg==;
29: Received: from c11-92.tlh.ro ([86.105.187.92]:59678 helo=localhost)

23: bh=Mfeb2i5EeCiNoEabwwaBRo8bnT4HLAR5z32ZZKIh8oo=; b=Izrj7xp7XVH0efHVJAFKpOIl1Y PNTYKwXkPmlu0QW9CNq0XNha3W1Rf/TD3qNMQxvkbn25G71nOseLQxORPcBItPDp3QJWzi7t8mDUH wccJjVfIvHoq7T+tuhB2vp64g6IMGwQ7XoGXXDreoumLQxv2yk/CwRneEjgO3fuBJbtnSggVMVWM0 RY7I8rMgIvHUeveZxjcL+DMKP1k7cHXTFrQj/0jnFqnjMFw3FNKt5QOSZMG2/Wem3I/V5VzOI2iEV aAXtbxdhkI94nuRueQ3b2UndL6MpQVjK+nS4dwfp9KPYU+pAXVusvreLloSAhSw+kcWgsUBMmyIe8 AcxxJoxQ==;
29: Received: from c11-92.tlh.ro ([86.105.187.92]:59460 helo=localhost)

32:     id 1bB7BJ-0005mx-Vc; Fri, 10 Jun 2016 00:08:02 +0300
32:     id 1bB7Ah-0005mG-EH; Fri, 10 Jun 2016 00:07:23 +0300

It seems that it is creating two separate emails with different ID's for some reason. I am struggling with this for over a week now and I just can't find out what is wrong.


texts: Admin order form - update custom area with ajax on add product

texts:
I add custom field to admin order form and I want it to be updated with ajax when admin add products to order, like other areas - shipping, billing and totals. I inspected file \vendor\magento\module-sales\view\adminhtml\web\order\create\scripts.js. There is a function

productGridAddSelected : function(){
        if(this.productGridShowButton) Element.show(this.productGridShowButton);
        var area = ['search', 'items', 'shipping_method', 'totals', 'giftmessage','billing_method'];
        ...

When I add my custom area name to it, like this, it works!

var area = ['custom_area', 'search', 'items', 'shipping_method','totals', 'giftmessage','billing_method'];....

But this is core file, so I need to do this somehow in my module. Any ideas how can I do this?


texts: How many domains does single Enterprise Edition support?

texts:
Is there a restriction on number of domain names per store?

I am aware that I can create multiple website inside a single Magento Enterprise Licence.

Lets say I have 10 odd number of individual domains purchased from different registras.

Can I switch them individually to my Magento Websites? Is there any restriction for number of domains ?


texts: M1 - TLS 1.2 - PayPal Express NVP CURL connection error #35: SSL connect error

texts:
I have a dev environment on an old sever running curl 7.19.7.

Recently I've noticed that Paypal Express no longer works and is returning an error "Unable to communicate with the PayPal gateway.".

Digging into the exception logs you can see

exception 'Exception' with message 'PayPal NVP CURL connection error #35: SSL connect error' in /path/app/code/core/Mage/Paypal/Model/Api/Nvp.php:983
Stack trace:
#0 /path/app/code/core/Mage/Paypal/Model/Api/Nvp.php(616): Mage_Paypal_Model_Api_Nvp->call('SetExpressCheck...', Array)
#1 /path/app/code/core/Mage/Paypal/Model/Express/Checkout.php(381): Mage_Paypal_Model_Api_Nvp->callSetExpressCheckout()
#2 /path/app/code/core/Mage/Paypal/Controller/Express/Abstract.php(108): Mage_Paypal_Model_Express_Checkout->start('http://asdf...', 'http://asdf...', false)
#3 /path/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Paypal_Controller_Express_Abstract->startAction()
#4 /path/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('start')
#5 /path/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 /path/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#7 /path/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#8 /path/index.php(210): Mage::run('uk', 'store')

I don't know if Paypal have changed anything with their sandbox recently, but went to the api-3t.sandbox.paypal.com URL on SSLLabs and saw that the only protocol they support is TLS 1.2.

After reading up on setting protocol versions in the PHP manual I hackily added the following

nano +194 lib/Varien/Http/Adapter/Curl.php

curl_setopt_array($this->_getResource(), $options);

+curl_setopt($this->_getResource(), CURLOPT_SSLVERSION, 6);

return $body;

Great! After an apache graceful I can now use Paypal express. However, I am not happy that I've had to hack the core. I'm also not happy that I've had to hack the core in a place specific to curl rather than to Paypal.

Does anyone have any advice on a correct way to fix this issue?

EDIT:

Just confirming some extra findings, this does not affect Paypal Standard in Magento as it does not appear to use curl under the hood. We were getting false negatives on certain machines.

Q: "How can this possibly be working! curl fails to connect to the sandbox on the command line"

A: "It's using paypal standard and not express, it doesn't use curl


texts: Magento 1 : loop over stores, find all salable products, then find children and update children to same website (scope) as parent

texts:
we need some code to do the following

Find all websites
Get salable products (show on frontend)
Then find all children belonging to that product
Update (actually add) website (scope) to the children same as parent
Option to add? Check first if there is a difference in website scope between parent and childrend
The end result would be that: all children always have the same website scope as the parents

Sample code nbut not finished ;)
// 1 get websites loop
foreach (Mage::app()->getWebsites() as $website) {
    $website_id = $website-getId();
    // 2 get collection of website
    $collection = Mage::getModel('catalog/product')->getCollection();
    $collection->addWebsiteFilter($websiteIds);
    // 3 get salable products only
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
    foreach ($collection as $parent) {
        // 4 get children
        $children_ids = $parent->getChildrenIds($parent->getId());
        if (!empty($children_ids)) {
            // 5 add? or overwrite? product_website
            // 6 also would be good to 'check first' if the websites scope is <> the same, and only if different from the parent then to update
            Mage::getModel('catalog/product_website')->addProducts($website_id, $children_ids);
        }
    }
}


texts: "URL key for specified store already exists" for category when importing products

texts:
The categories the products needs to be imported to are already created. When I try to import the products I get this error:

1. Category "Default Category/Accessories/Mobil Sleeves" has not been created. URL key for specified store already exists. in row(s): 32, 33, 34, 35, 36, 37, 38, 39, 40, 41

Row 32, column categories content:

Default Category/Accessories/Mobil Sleeves,Default Category/Mærker/Accessories/Decadent,Default Category/Accessories,Default Category/Udsalg,Default Category/Accessories/UDSALG Accessories

All products has unique a url_key
Category name is Mobil Sleeves. Full category path is: Default Category/Accessories/Mobil Sleeves
Category url_key: mobil-sleeves
in the table url_rewriteonly one instance exists for the category: accessories/mobil-sleeves.html
I use Magento 2.1.2


texts: magento - unable to save products in quote

texts:
I am working magento payment gateway

$product_model = Mage::getModel('catalog/product');
$code = Mage::app()->getStore()->getCode();
$product_id = $product_model->getIdBySku('billmate_faktura_'.$code);
$_product = Mage::getModel('catalog/product')->load($product_id);

$price = $_product->getPrice();
$orderItem = Mage::getModel('sales/quote_item')
    ->setStoreId($storeId)
    ->setProduct($_product)
    ->setQuoteItemId(0)
    ->setQuoteParentItemId(NULL)
    ->setProductId($product_id)
    ->setProductType($_product->getTypeId())
    ->setQtyBackordered(NULL)
    ->setTotalQtyOrdered(1)
    ->setQtyOrdered(1)
    ->setQty(1)
    ->setName($_product->getName())
    ->setSku($_product->getSku())
    ->setPrice($price)
    ->setBasePrice($price)
    ->setOriginalPrice($price)
    ->setRowTotal($price)
    ->setBaseRowTotal($price);
    $quote->addItem($orderItem);

    $quote->save();

When i complete order. i can't see this product in admin order detail page. please tell me if i did something wrong.

This is not working actually i am try to add this product for invoice fee purpose but when i complete order then my fee product not added anywhere.


texts:
I add new product and: qty=1 salableqty=1
Now I sold product and salableqty=0 but qty still = 1
Product still visible on frontend but impossible add to the basket.  Why system also not set for this product qty 0?
How to solve?https://prnt.sc/10iopbq


texts:
I need to center-align a button in a login form and I can't manage to do it. The reason for that is that there is a css property inherited from div .page (text-align: left). I tried to assign the property text-align:center to the element itsef, but there is no effect, and the .page property seems to prevail over it.
I saw that the < div class="page" comes from 1column.phtml, so it affects all my page.

Anyone knows how could I center-align the button?


texts: Payments Standard success error in magento 2.2.6

texts:
Payments Standard payment success error in magento 2.2.6
1 exception(s):
Exception #0 (Magento\Framework\Exception\InputException): Id required

Exception #0 (Magento\Framework\Exception\InputException): Id required
#0 /var/www/vhosts/mariposacoffeecompany.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\OrderRepository->get(NULL)
#1 /var/www/vhosts/mariposacoffeecompany.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\OrderRepository\Interceptor->___callParent('get', Array)
#2 /var/www/vhosts/mariposacoffeecompany.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\OrderRepository\Interceptor->Magento\Framework\Interception\{closure}(NULL)
#3 /var/www/vhosts/mariposacoffeecompany.com/httpdocs/generated/code/Magento/Sales/Model/OrderRepository/Interceptor.php(26): Magento\Sales\Model\OrderRepository\Interceptor->___callPlugins('get', Array, Array)

success page return url error


texts: Magento 1.9.3.2 Newsletter Template edit mode removes code bits randomly

texts:
I am using the bulletproof background tool found here to create background images that will work in outlook. Once this is done, I go to edit my newsletter template and paste the generated snippet into the code view and save then preview. It works splendidly.

However, going back into the template for further edits I have to keep re-pasting this code as  magento annoyingly keeps removing the background attribute from the td and table. Very unusual, would anyone have an idea as to why this is occuring?

Snippet is:

`

Introducing Our New Product Range!

`

The code is not out of the ordinary and I cannot fathom as to why this is occurring. If anyone could help I would thoroughly appreciate this.


texts: URL Rewrite not working as expected when product uploaded through magmi?

texts:
I tried,

i) Stores-->Configuration-->Catalog-->Catalog-->SEO-->Use Categories Path for Product URLs to YES.
ii) php bin/magento indexer:reindex

I have again saved Categories but still no effect in url.
catalog/product/view/id/2140/room-set/category/11/


texts: Magento and Maximum Server Request Server Setting

texts:
I am running Magento CE 1.9. and the configuration of my Group Product pages requires the page to generate 1,000s of request just for one page. That is not gong to change it is the nature of the type of products we sell.
Our apache.conf the MaxClients: allowed to start is set to 150.
I have asked my Hosting company to increase that figure to 10,000 and they have refused. What are the best practices in this case?


texts: Magento 2: modules are not listing in admin panel

texts:
On my test server, every installed extensions are not listing in admin panel under Stores > Settings > Configuration > Advanced > Advanced.

And if the extension has configuration parameters vendorName/moduleName/etc/adminhtml/system.xml, module configuration tab is not visible under Stores > Settings > Configuration

Doing php bin/magento module:status the modules are listing and they are enabled.

Checking in the database (setup_module table) the modules are listing.

Checking in app/etc/config.xml the modules are listing and set to '1'.

On my local machine, all works fine so it must be a server issue (permissions ???).

I don't understand what is the problem.


texts: Magento CE 2.3.2 TypeError: setCouponCodeAction.registerDataModifier is not a function

texts:
After updating Magento CE 2.3.1 to 2.3.2 incl. updating libsodium we have trouble with our checkout.

When trying to access the checkout - does not matter which way - we get the following TypeError:

TypeError: setCouponCodeAction.registerDataModifier is not a function.

In our theme we moved the voucher section to the right sidebar but that wasn't a problem in Magento CE v2.3.1.

Any idea what to do?


texts:
Struggling to update or do anything with composer and get the same error every time:

  [Seld\JsonLint\ParsingException]
  "./composer.json" does not contain valid JSON
  Parse error on line 15:
        "phpunit     ": {re
  ----------------------^
  Expected one of: 'STRING', '}'

Any help would be much appreciated.