texts:
i have insall elasticsearch in ubuntu. using this link
but when I run this command "sudo systemctl start elasticsearch"
i get below error.
Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

then I run this command systemctl status elasticsearch.service
I get below error
elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Thu 2020-12-17 17:43:29 IST; 28min ago
       Docs: https://www.elastic.co
    Process: 93868 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=143)
   Main PID: 93868 (code=exited, status=143)

Dec 17 17:42:12 rushikesh systemd[1]: Starting Elasticsearch...
Dec 17 17:43:28 rushikesh systemd[1]: elasticsearch.service: start operation timed out. Terminating.
Dec 17 17:43:29 rushikesh systemd[1]: elasticsearch.service: Failed with result 'timeout'.
Dec 17 17:43:29 rushikesh systemd[1]: Failed to start Elasticsearch.

then I run this command journalctl -xe
and I get below error,
Dec 17 17:30:28 rushikesh /usr/lib/gdm3/gdm-x-session[1974]: See https://wayland.freedesktop.org/libinput/doc/1.15.5/touchpad-jumping-cursors>
Dec 17 17:30:32 rushikesh dbus-daemon[823]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' req>
Dec 17 17:30:32 rushikesh systemd[1]: Starting Fingerprint Authentication Daemon...
-- Subject: A start job for unit fprintd.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit fprintd.service has begun execution.
--
-- The job identifier is 15769.
Dec 17 17:30:32 rushikesh PackageKit[90821]: daemon quit
Dec 17 17:30:32 rushikesh systemd[1]: packagekit.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit packagekit.service has successfully entered the 'dead' state.
Dec 17 17:30:33 rushikesh dbus-daemon[823]: [system] Successfully activated service 'net.reactivated.Fprint'
Dec 17 17:30:33 rushikesh systemd[1]: Started Fingerprint Authentication Daemon.
-- Subject: A start job for unit fprintd.service has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit fprintd.service has finished successfully.
--
-- The job identifier is 15769.
Dec 17 17:30:34 rushikesh gdm-password][91752]: pam_unix(gdm-password:auth): Couldn't open /etc/securetty: No such file or directory
Dec 17 17:30:41 rushikesh gdm-password][91752]: pam_unix(gdm-password:auth): Couldn't open /etc/securetty: No such file or directory
Dec 17 17:30:41 rushikesh gdm-password][91752]: gkr-pam: unlocked login keyring
Dec 17 17:30:41 rushikesh NetworkManager[824]: <info>  [1608206441.8908] agent-manager: agent[e037d5e0796523ba,:1.95/org.gnome.Shell.NetworkA>
Dec 17 17:30:41 rushikesh dbus-daemon[1895]: [session uid=1000 pid=1895] Activating service name='org.freedesktop.FileManager1' requested by >
Dec 17 17:30:42 rushikesh dbus-daemon[1895]: [session uid=1000 pid=1895] Activating service name='org.gnome.Nautilus' requested by ':1.44' (u>
Dec 17 17:30:44 rushikesh dbus-daemon[1895]: [session uid=1000 pid=1895] Successfully activated service 'org.gnome.Nautilus'
Dec 17 17:30:44 rushikesh org.gnome.Nautilus[91789]: Failed to register: Unable to acquire bus name 'org.gnome.Nautilus'

how can fix this?


texts: Magento2 Sales Order Totals Wrong on Order Email

texts:
I'm using Magento 2.3.4 and have my catalog set up so all the prices include tax, all the emails include tax and all the prices include tax.
The issue is that the order confirmation email doesn't send the subtotal and shipping values with taxes (but send the total and items with taxes). The invoice email and credit memo email display the prices correctly.
I've double checked everything and everything seems ok.
Can someone help me, please?
Regards


texts: Magento1 admin product image upload issue

texts:
I have installed Magento1 Patch SUPEE-8788 in my local system. But I have an issue, in Admin Panel, Product Image Upload Browse Button is Not Working.

1 File: app\code\core\Mage\Adminhtml\Block\Media\Uploader.php

class Mage_Adminhtml_Block_Media_Uploader extends Mage_Uploader_Block_Multiple
{
    /**
     * Constructor for uploader block
     */
    public function __construct()
    {
        parent::__construct();
        $this->getUploaderConfig()->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload'));
        $this->getUploaderConfig()->setFileParameterName('file');
    }
}

2 File: app\design\adminhtml\default\default\template\media\uploader.phtml

<?php
/**
 * @var $this Mage_Uploader_Block_Multiple|Mage_Uploader_Block_Single
 */
?>
<div id="<?php echo $this->getHtmlId() ?>" class="uploader">

        <?php echo $this->getBrowseButtonHtml(); ?>
        <?php echo $this->getUploadButtonHtml(); ?>

<div class="no-display" id="<?php echo $this->getElementId('template') ?>">

        {{name}} {{size}}
        <?php echo $this->getDeleteButtonHtml() ?>

<?php echo $this->getChildHtml('additional_scripts'); ?>


texts: how to retrive a qty of product from a specific cart in soap client2?

texts: please help me out. I am adding a product to a cart using cart_product.add (SOAP V1) with a qty-2. But when a retrieve a cart_product.list at that time I am not getting a qty. So how can i get the qty of product of cart?


texts: env.php in Docker containers with pipeline deployment

texts:
I wanna be able to deploy and run Magento 2 using Docker images
I am following Magento 2.2+ pipeline deployment docs:
https://devdocs.magento.com/guides/v2.4/config-guide/deployment/
https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-subcommands-deployment.html
When runnning pre-build php image with Magento source code, I need to create app/etc/env.php
I have tried to set configuration for env.php via bin/magento setup:config:set in my entrpoint (from ENV vars) which creates env.php file, but it does not include a way how to set 'install' => ['date' => 'Fri, 31 Jun 2020 18:00:00 +0000'] configuration. So Magento still does not know, that system is installed, and redirects to /setup.
Magento installation runs seprately (before runtime containers are created), and runtime containers should be able to scale easily.
And I dont want to rely on Docker volumes to bind app/etc/ folder to runtime containers. Containers should be self sufficient.
Am I missing something?
Thanks


texts:
I'm new to magento (using it from only 1 weeks) and I'm trying to use the following instruction from a css file located in

skin/frontend/responsive/<storeViewName>/css/<MyDevName>/slideShow/mySlideShow.css

which I think is the good place and practice. I'm using the following instruction for which I have an issue:

.mySlider {
    background-image: url(<media_base_url>/arlian/slideShow/loading_icon/ajax-loader.gif) !important;
}

I have stored my loader img also where I think it is the right place to do so (but I may be wrong):

media/arlian/slideShow/loading_icon/ajax-loader.gif

My issue is how can I reference the correct path to ajax-loader.gif into the css file ?
I know I can use Mage::getBaseUrl('media') from a php/phtml file and {{media url='....'}} from CMS/static html but despite all my google search, I didn't find any way to reference the media path in Magento style to be used in a css file.

May someone tell me how to do that or what is the good practice to achieve this if my approch is wrong in the magento world ?


texts: {{inlinecss file="email-inline.css"}} not working in custom email template

texts:
I copied email template from one of default magento email. and i am getting everything in email but css not being loaded in email.

<template>
    <email>
        <test_email_template translate="label" module="dio">
            Test Email Template
            <file>test/test_email_template.html</file>
            <type>html</type>
        </test_email_template>
    </email>
</template>

below is controller code for calling email template.

$emailTemplate = Mage::getModel('core/email_template')->loadDefault('test_email_template');
$template_variables = array(
    'name' =>  'helllo',
);

$processedTemplate = $emailTemplate->getProcessedTemplate($template_variables);

try {
    $z_mail = new Zend_Mail('utf-8');
    $z_mail->setBodyHtml($processedTemplate)
        ->setSubject('Test')
        ->addTo('test@gmail.com')
        ->setFrom('test1@gmail.com', "tesing");
    $z_mail->send();
} catch (Exception $e) {
}

and this is my test_email_template.html file code.

{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}

        {{var name}}

{{template config_path="design/email/footer"}}

everything is working fine and i am getting email but css is not loading in email.
is there any solution for that?


texts:
Cron is not working properly showing error in /var/www/domain.com/var/log/update.log

[2019-09-25 07:07:02] update-cron.ERROR: Cron readiness check failure! Found non-writable paths:    /var/www/domain.com/bin/magento [] []

There is already pemission to bin/magento file.

log in file /var/www/domain.com/var/log/.update_cronjob_status

{
    "readiness_checks": {
        "error": "
Found non-writable path(s):
/var/www/domain.com/bin/magento",
        "file_permissions_verified": false
    },
    "last_timestamp": 1569386101,
    "current_timestamp": 1569386522
}


texts: No Emails sent to customers or owner after old backup installed

texts:
i had to re-install a backup recently and since i have not been able to receive order emails and customer dont receive them either.

i have uploaded AOE Scheduler and it says No heartbeat task found. Check if cron is configured correctly.

On the server the cron job is set to
php -f /home/username/public_html/cron.php
*5****

The file permission for cron.php is 744
The file permission for cron.sh is 644

In setup Instructions it has these settings
sudo crontab -u timportsco -e

! test -e /home/timportsco/public_html/maintenance.flag && /bin/bash /home/timportsco/public_html/scheduler_cron.sh --mode always

! test -e /home/timportsco/public_html/maintenance.flag && /bin/bash /home/timportsco/public_html/scheduler_cron.sh --mode default

I dont have ssh access only through cpanel
Which files need changing.

In mysql cron schedule everything is pending and has been form hours.

Please can someone help


texts: Magento 2.2.5 Show customer header links in Category navigation menu

texts:
In Magento 2.2.5, Is there any way to display the top customer header links in Category navigation menu.

Like this


texts: Add a value to text input field in custom options - frontend

texts:
I want to add a default value to text input field in custom options to pass the magento validation. I try to do this in javascript like that: jQuery(".product-options dd input.input-text").attr('value', '--------'); But in some places I need to remove this value: jQuery(".product-options dd input.input-text").attr('value', ''); and when I use this last code, I have: Please specify the product's required option(s).

Thank you


texts: Uploading product placeholder images through Magento2 Admin fails

texts:
While uploading the product placeholder images through Magento 2 Admin

System throws this error message

"Invalid parameter given. A valid $fileId[tmp_name] is expected".

I cannot find any old post on this issue here.

Any Help will appreciate!!


texts: M2 / Cart price rule : condition based on shipping_method does not work for some carrier

texts:
I'm trying to setup a rule to offer shipping fees for 1 specific carrier, to a customer group.
Customer segment for the rule : "group1"
Under "Condition" tab, I set :
if shipping_method IS "my_carrier1"
Then do the magic.
Everything works as expected, when I select carrier1 in the cart, shipping fee are 0.00€.
When I change the carrier in my condition to "carrier2" ou "OtherCarrier", free shipping is not working anymore.
I suspect the way the condition evaluates the shipping_method to be the source of the problem, but I still don't know where to look for.
Thank you for your help.


texts: Plugin Method for customer Data Provider in Magento2

texts:
Are there any plugin method for customer Data Provider to modify the address on the checkout page.

I am trying to override the address section, to be rendered on checkout for the customer.

I came to know it is loading from the Data Provider of model file of module customer.

I need help with how to use a plugin method for it? Can it be overridden?, I need to add more to address for the address object. Can this be done?

Please help me.


texts: magento project on ubuntu works as php project

texts:
I'm deploying on ubuntu ec2 instance and it had worked fine at first.

but now when I deployed some updates and tried to open the store it gives me the page in the image

why that's happening


texts:
I filled in the info for Sales> Google API and it also said to fill the tracking code in the Head HTML in Design. After doing that I checked the website and everything is loading except when I click on a product or a category. I get this:

  Fatal error: Call to a member function addToChildGroup() on null in
  /home/bvsecuri/public_html/app/code/core/Mage/Core/Block/Abstract.php
  on line 815

Please help me fix it! I do not know how this happened when yesterday the site was fine.


texts: Magento 2 how to get row total with discount?

texts: Normally in Magento 2 cart page show subtotal. But I would like to get subtotal after deducting discount if any cart rules applied or coupon code applied to any product.


texts: How Can i add custom product collection in all category product listing page in magento 2?

texts:
i have one category name Deals in that there is no any product present
also i have one product attribute name "is_deal_product" yes/no type
so if this attribute value yes in any product than they show in Deals category page,
my collection code is here
$currentCategoryId = $this->layerResolver->get()->getCurrentCategory();
        if($currentCategoryId == '66')
        {
            $result = $this->pageFactory->create();

            // obtain product collection.
             // do some filtering
            $this->productCollection->addFieldToSelect('*');
            $this->productCollection->addAttributeToFilter('status', ['in' => $this->productStatus->getVisibleStatusIds()]);
            $this->_productCollection->addAttributeToFilter('is_deal_product', 1);
            $this->productCollection->setVisibility($this->productVisibility->getVisibleInSiteIds());

            // get the custom list block and add our collection to it
            /** @var CustomList $list */
            // $list = $result->getLayout()->getBlock('custom.products.list');

            $list->setProductCollection($this->productCollection);

            return $result;
        }

but i have no idea to how can i set this in list.phtml file can any one help me


texts: Value for 'msrp_display_actual_price_type' attribute contains incorrect value

texts:
When i try to import my early exported export i get a error regarding msrp_display_actual_price_type but the DB tells me the input must be 4.

"1. Value for msrp_display_actual_price_type attribute contains incorrect value, see acceptable values on settings specified for Admin in rij(en): 1"

But this seems to be wrong.

Does anyone know why this is happening, i'm using Magento2 2.1.15


texts: Undelivered mail returned to user when sending mail from default Magento SMTP in magento 2.3.2

texts: When sending mail to a mail id after submitting contact form Undelivered mail returned to user.we are using default magento SMTP for sending mails with host smtp.sendgrid.net.Anybody know abouth the reason, Magento version is 2.3.2


texts:
I have configured the method of calculation for each region is finished, but also one that, if the bill over $ 500, I will free shipping, which I do not know the configuration of items, you do know the show I think this is my website, no test you try this out http://dreamsfashion.com.vn, please help me,

please, I thank you very much


texts: Magento 2 : Display Blogs on Homepage (Magefan Blog Module)

texts:
How to display all blogs on home page using Magefan Blog Module.

Please suggest me any solution.


texts: Magento 1: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous

texts:
I am getting the Error:

  Integrity constraint violation: 1052 Column 'status' in where clause
  is ambiguous

SELECT `main_table`.*, CONCAT(soa.firstname,' ', soa.lastname,'', soa.street,'', soa.city,'', soa.region,'', soa.postcode)  AS `full_address`, CONCAT(soas.firstname,' ', soas.lastname,'', soas.street,'', soas.city,'', soas.region,'', soas.postcode) AS `full_address_ship`, group_concat(`sales/order_item`.sku SEPARATOR ', ') AS `skus`, group_concat(`sales/order_item`.name SEPARATOR ', ') AS `names`, group_concat(`sales/order_item`.product_id SEPARATOR ', ') AS `proid`, group_concat(`sales/order_item`.product_type SEPARATOR ' ') AS `product_type`, `order`.`total_qty_ordered`, `order`.`customer_email` AS `emailbuyer` FROM `sales_flat_order_grid` AS `main_table`
 INNER JOIN `sales_flat_order_address` AS `soa` ON soa.parent_id=main_table.entity_id and soa.address_type = 'billing'
 INNER JOIN `sales_flat_order_address` AS `soas` ON soas.parent_id=main_table.entity_id and soas.address_type ='shipping'
 INNER JOIN `sales_flat_order_item` AS `sales/order_item` ON `sales/order_item`.order_id=`main_table`.entity_id
 LEFT JOIN `sales_flat_order` AS `order` ON order.entity_id = main_table.entity_id WHERE (status = 'processing') GROUP BY `main_table`.`entity_id` ORDER BY main_table.created_at DESC LIMIT 20

Why can't it find the status column?


texts: Type Error occurred when creating object: Magento\Framework\Communication\Config\Data

texts:
My application Runs on Magento2 2.3.4-p2 Version , till yesterday it was working fine , and I haven't changed any code modifications. But throws following error

I have followed Clearing the Cache. Removing the Generated folders , Var and Cache Folders.
I Have given the appropriate Permission to the Folders also.
Also i have checked here , but didn't find any thing
Please let me know , what was the issue and Solution for It


texts: Magento 2: How to get Order Item's Direct Without Inner Loop

texts:
I have below code for fetching Order's which has payment method "Paypal Express"

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderCollection = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\Grid\Collection')
                ->addFieldToFilter('main_table.payment_method', 'paypal_express')
                ->addFieldToFilter('sop.method', 'paypal_express');

        $orderCollection->getSelect()->joinLeft(
                ['si' => 'sales_order_item'], "main_table.entity_id = si.order_id");

        $orderCollection->getSelect()->joinLeft(
                ['sop' => 'sales_order_payment'], "main_table.entity_id = sop.entity_id");

        $orderCollection->load();
        //echo $orderCollection->printlogquery(true);

        foreach ($orderCollection as $orders) {
            echo $orderCustomerId = $orders->getCustomerId();
            echo "<pre>";
            echo $orderPaymentMethod = $orders->getPaymentMethod();
            echo "<pre>";
            echo $orderId = $orders->getId();
            echo "<pre>";
            echo $orderTransactionId = $orders->getLastTransId();
            echo "<pre>";
            $orderDetail = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);
            $orderItems = $orderDetail->getAllItems();
            foreach ($orderItems as $item) {
                echo "<pre>";
                echo $itemPrice = $item->getPrice();
                echo "<pre>";
                echo $itemSku = $item->getSku();
            }
        }

For getting Order wise items, I have to Create Inner Foreach Loop, is there any way to remove it & access order items from 1st Foreach?


texts: Can anybody tell me that how can I remove all the settings associated to the extension from the database tables. Like if I am uninstalling the "abc" extension than the value abc_setup will also be deleted from the core_resource table. Similarly other setting from the core_config_data table too. And also delete the database tables too.


texts: Saving New Product Attribute Doesn't Save

texts:
I was wondering whether you could assist me with an issue that I have had for some period of time. I am trying to add product description and specification tabs to each product.

I am following this simple guide to achieve this:

The error I'm getting is on step 1: Creating an attribute;

When creating the attribute and saving, the attribute created doesn't save and in fact just 'grey's out' the 'Save Attribute' & 'Save and Continue edit' buttons:

Which stops me progressing. Can anyone think of a reason as to why this would be happening?

Any answers appreciated greatly.


texts: What is the purpose of customer_grid_flat table?

texts: can someone please tell me what is the purpose of Magento's customer_grid_flat table? What is it used for?


texts: Currency symbol acting weird in magento2

texts:
I am trying to display "SEK" instead of "kr" in magento2 when showing currency symbol. However, when i deselect "Use standard" it refuses if the box says "SEK" and when i save it is set at "Use standard" again and the site shows "kr" still.

If i write something else, for example: "TEST". It will display TEST instead of kr and the "Use standard" box will remain unchecked.

Do i use the setting incorrectly or might this be a bug in Magento 2?


texts: Payment Information row headers displaying variable names instead of normal text

texts:
I've stumped myself. Recently, orders are coming through with the rows in the 'payment info' region displaying what appears to be variable names instead of their human-readable versions. No changes have been made recently that should have affected this region. See below for a screenshot.
The most recent actions taken were a quick flip into development mode and back, and backorders were enabled. Not expecting either to be relevant, but listing them just in case they trigger an idea. I have rebuilt static content, reindexed, and cleared the caches.

This content block displays incorrectly both on emailed order templates, and in the admin's orders area. In the order email template, {{var payment_html|raw}} pulls this up.
Thanks for any help!


texts: Problem with update from 1.9.3.7 to 1.9.3.8

texts:
Yesterday I tried to update my 1.9.3.7 Version to 1.9.3.8
I tried it with the connect manager.
While the process the update stucks with magento "Checking dependencies of packages".

After a few time I load the window new and only Interface_Adminhtml_Default and Cm_RedisSession was updated.

I search with google for similar problems. I read something about problem with permission rights, but I don't now which file or directory it could be. So I changed all rights to 777 and 666 with shh. Its not a productive Website its only a sandbox (Copy from my real Website), but the problem still there.

Have any one a solution for me?


texts:
I am having this issue after updating Magento from 2.3 to 2.3.2

Fatal error:

  Declaration of Magento\QuoteGraphQl\Model\Cart\SetShippingAddressOnCart::execute(Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context, Magento\Quote\Api\Data\CartInterface $cart, array $shippingAddresses):

  void must be compatible with Magento\QuoteGraphQl\Model\Cart\SetShippingAddressesOnCartInterface::execute(Magento\GraphQl\Model\Query\ContextInterface $context, Magento\Quote\Api\Data\CartInterface $cart, array $shippingAddressesInput):

  void in /my/folder/public_html/app/code/Magento/QuoteGraphQl/Model/Cart/SetShippingAddressOnCart.php on line 20

I can't figure out even what it mean.

Is it from third-party module conflict or Magento native?

Any help please?


texts: API integrates and return the value in ajax

texts:
I have integrated the third party API for validating a correct email address with the domain. The API call is returning the value in the ajax call as Boolean.

How to retrieve the value from the API response in ajax?


texts: Custom Payment Module Based on the Sample gateway code

texts:
I am working to develop a payment gateway for Mpesa, a payment wallet we use in Kenya.

I have done one for Zencart which works perfectly. Unfortunately I have not worked with Magento much and need assistance for a starting point.

I just need to send a soap request and receive and interpret the response. I would love to get an idea which files based on the sample payment gateway module provided by Magento I will need to work on.


texts: Remove category attribute script not working in magento 2.3.1

texts:
Hi I am trying to remove the category attribute using Uninstall script but it is not working. Here is my code. Setup\Uninstall.php

 <?php

namespace Company\Module\Setup;

use Magento\Eav\Setup\EavSetupFactory;

use Magento\Framework\Setup\UninstallInterface;

use Magento\Framework\Setup\SchemaSetupInterface;

use Magento\Framework\Setup\ModuleContextInterface;

class Uninstall implements UninstallInterface
{

    protected $eavSetupFactory;

    public function __construct(EavSetupFactory $eavSetupFactory)
    {
        $this->eavSetupFactory = $eavSetupFactory;
    }

    public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        $eavSetup = $this->eavSetupFactory->create();

        $entityTypeId = 3;
//        $entityTypeId = \Magento\Catalog\Model\Category::ENTITY;

        if (version_compare($context->getVersion(), '1.0.4') < 0) {
            $eavSetup->removeAttribute($entityTypeId, 'test_input_field');
        }

        $setup->endSetup();

    }
}

Any help appreciated.


texts: How the Magento 2 Final price calculate for the simple product?

texts:
I am learning the Magento 2 price logic, so I am started from the simple product final price calculation logic.
So the final price is the least amount from the regular_price, Catalog price rule, special price & tier price.

for my simple product Regurlar price: 100, Catalog price rule: 10(fixed), special price: 80 and tier price for one qty is 70, 2 qty is 130.

When I added one qty to cart its take the least amount among the above, so it's 70, but when I added two qty to cart it's should be 130, but for me, it's showing 140.

Any one explain this final price calculation logic, thanks in advance for your support.


texts: Adding attribute input validation in admin

texts:
I have already added a new validator within theme's validation.js, and am able to use it within custom forms.
I would now like to add a new option under Input Validation dropdown on the edit attribute attribute screen in the admin, and for the dropdown to then add the relative validator reference on the frontend.
For example, out of the box Alphanumeric with Spaces in DB is saved as alphanum-with-spaces, and on frontend, once rendered has a validator of validate-alphanum-with-spaces.
What needs to be done to make this possible?


texts:
I want to get ONE random product from the productlist of a category. The product must have "status=1".

Is it possible?

Thx.


texts: Magento2 custom/different flat shipping charge for few products

texts:
I want to charge custom shipping charge for few product available in store is it possible? i.e  currently i am charging flat shipping chargefor all product how to charge custom/different price few product.

example : charging $5 flat charge to all product. But i want to charge $45 for product1, $99 for product2, $114 for product3 etc.


texts: How to check first level categories is available or not?

texts:
In frontend i m displaying all category of first level.

Now I want to check there is any category available or not in first level.

I am using this code get all category of first level

public function getCategory()
{
    $parentCategoryId = Mage::app()->getStore()->getRootCategoryId();
    $categories = Mage::getModel('catalog/category')
        ->getCollection()
        ->addFieldToFilter('parent_id', array('eq'=>$parentCategoryId))
        ->addFieldToFilter('is_active', array('eq'=>'1'))
        ->addAttributeToFilter('level', 2)
        ->addAttributeToSelect('*');
    return $categories;
}

If there is no category available i want to display a message but i don't know how to check category is available or not


texts: Magento loading Model from wrong directory

texts:
I'm trying to load a model with: Mage::getModel('OnePica_AvaTax/AvaTax_Estimate') but Magento errors with Warning: include(Mage\OnePica\AvaTax\Model\AvaTax\Estimate.php): failed to open stream: No such file or directory, when this model is in the Community folder, not the Core folder... Mage shouldn't be there at all.

I know I've dealt with this in the past, but I can't remember what the correct way to do this is.


texts: How to change text in customer dashboard sidebar?

texts:
I need to change the Address book text to My Contact Details in customer dashboard sidebar links.

I used this below code but no use.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <referenceContainer name="sidebar.main">
            <block class="Magento\Framework\View\Element\Template" name="sidebar.main.account_nav" template="Magento_Theme::html/collapsible.phtml" before="-">

                    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-address-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">My Contact Details</argument>
                            <argument name="path" xsi:type="string">customer/address</argument>
                            <argument name="sortOrder" xsi:type="number">190</argument>
                        </arguments>
                    </block>
            </block>
        </referenceContainer>
    </body>
</page>

In **customer_account.xml*.*


texts: Admin panel slow response (5- 6 seconds)

texts:
Generally the admin panel in my magento store is very responsieve 1-2 seconds. However sometimes the the response is much slower 5-6 seconds. I have reindexed, and refreshed and flushed cache, and still the same issue, 5-6 seconds response with every click.

I've been having this issue ON and OFF in the past, sometimes it would clear up and response will be back to 1-2 seconds.

p.s. Front end of site works very fast.

Any idea what could be the issue?


texts:
With the code below I can load all the attributes from a specific group, in this case attribute group with id: 37

<?php
    $av_attribute_group = $_product->getAttributes(37);

    foreach ($av_attribute_group as $av_attribute_groups):

        $av_attr_name = $av_attribute_groups->getName();
        $av_attr_label = $_product->getResource()->getAttribute($av_attr_name)->getFrontend()->getLabel($_product);
        $av_attr_value = $_product->getResource()->getAttribute($av_attr_name)->getFrontend()->getValue($_product);

        if( $av_attr_value != "" ) :

        ?>

<?php echo $av_attr_label; ?>

                    <?php
                        if( $av_attr_value == "Yes" || $av_attr_value == "Ja" ) : ?>

                        <?php elseif( $av_attr_value == "No" || $av_attr_value == "Nee" ) : ?>

                        <?php else :
                            echo $av_attr_value;
                        endif;
                    ?>

        <?php endif; ?>
<?php endforeach ?>

But I also want to load the name of attribute group with id 37, how can I do that?

Regards,


texts:
I want to customize the content of the invoice PDF(printable from admin backend).

But all the threads I read so far (Magento devdocs do not contain guidance on this) direct to folders like model/order/PDF/invoice.php that simply do not exist anymore in Mangento 2.3.3.

Please help me to find out where the PDF related *.php files are now in Magento 2.3.3.


texts: Sorting products in parent category by subcategories and position

texts:
Question: I have sorted products in my subcategories by positions, but the sorting is not working for the parent category. For some reason magento mixes everything up (which I find extremely illogical). Can anyone tell me how I can make the parent category sort the products by the position and so that they go subcategory by subcategory not mixing up altogether.

In advance: there are solution in the internet but there is too little details. Solutions say something like - create a class with this content...

I am an absolute newbie in magento and I don't know where I need to create files, how to name them etc. Please, as more details as possible.

Thanks in advance.


texts: stipe payment form not working on checkout page


texts: My Save Config Button [Stores>Configuration] in Magento 2.3.3 Doesn't Work

texts:
I can't make any changes because after making the changes the save config button just doesn't work.

Please help.
Thank you


texts: Magento 1.9.1 Helper Class not found error

texts:
While creating the new page in Admin panel, getting the error as Fatal error: Class 'Ddevs_Ebayaff_Helper_Data' not found in /var/www/html/bitkarshop/app/Mage.php on line 547 My config files are as follows..

  In app\code\local\Ddevs\Ebayaff\etc\adminhtml.xml

<config>
    <menu>
       <main_menu translate="title" module="example">
           <title>Main Menu</title>
               <sort_order>1</sort_order>
               <children>
               <sub_menu1 translate="title" >
                    <title>Sub Menu 1</title>
                    <sort_order>10</sort_order>
                    <action>adminhtml/submenu1</action>
               </sub_menu1>
               </children>
       </main_menu>
   </menu>
</config>

  In app\code\local\Ddevs\Ebayaff\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Ddevs_Ebayaff>
            <version>0.1.0</version>
        </Ddevs_Ebayaff>
    </modules>
    <global>
        <resources>
            <add_category_attribute>
                <setup>
                    <module>Ddevs_Ebayaff</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                </setup>
            </add_category_attribute>
        </resources>

        <helpers>
      <example>
         <class>Ddevs_Ebayaff_Helper</class>
      </example>
   </helpers>
    </global>
....

  In app\code\local\Ddevs\Ebayaff\Helper\Data.php

<?

class Ddevs_Ebayaff_Helper_Data extends Mage_Core_Helper_Data{

}

Once going to Admin panel i am getting the following error.

Fatal error: Class 'Ddevs_Ebayaff_Helper_Data' not found in /var/www/html/bitkarshop/app/Mage.php on line 547


texts: Show product view page as two pages in magento

texts: I have a configurable product in magento and I have a requirement to show configurable product options in one page and the custom options, add to cart button in another page. Is is possible to do this? If possible how to pass configurable product option to next page.


texts: Default store as empty value in customer creation page

texts:
I would like to set default store value to empty value or 0 in stores dropdown list near field "Send Welcome Email From", in customer creation page.

I like also to receive an error when user keeps the empty value and when he don't choose a store value.

In cutomer_form.xml in module-customer, i found

<field name="sendemail_store_id" formElement="select">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">customer</item>
            </item>
        </argument>
        <settings>
            <dataType>number</dataType>
            <label translate="true">Send Welcome Email From</label>
            <imports>
                <link name="value">${ $.provider }:data.customer.store_id</link>
            </imports>
        </settings>
        <formElements>
            <select>
                <settings>
                    <options class="Magento\Store\Model\System\Store"/>
                </settings>
            </select>
        </formElements>
    </field>

And in /vendor/magento/module-customer/Model/Customer/Attribute/Source/Store.php i found this function getAllOptions, is there the correct function to change it?

 public function getAllOptions($withEmpty = true, $defaultValues = false)
 {
    if (!$this->_options) {
        $collection = $this->_createStoresCollection();
        if ('store_id' == $this->getAttribute()->getAttributeCode()) {
            $collection->setWithoutDefaultFilter();
        }
        $this->_options = $this->_store->getStoreValuesForForm();
        if ('created_in' == $this->getAttribute()->getAttributeCode()) {
            array_unshift($this->_options, ['value' => '0', 'label' => __('Admin')]);
        }
    }
    return $this->_options;
}

EDIT:

Following this

<options class="Magento\Store\Model\System\Store"/>

I searched in class /vendor/magento/module-store/Model/System/Store.php, and found this function

public function getStoreValuesForForm($empty = false, $all = false)
{

    $options = [];
    if ($empty) {
        $options[] = ['label' => '', 'value' => ''];
    }
    ***$options[] = ['label' => '', 'value' => ''];*** // I added this, but how to set it as default?

    if ($all && $this->_isAdminScopeAllowed) {
        $options[] = ['label' => __('All Store Views'), 'value' => 0];
    }

    $nonEscapableNbspChar = html_entity_decode('&#160;', ENT_NOQUOTES, 'UTF-8');

    foreach ($this->_websiteCollection as $website) {
        $websiteShow = false;
        foreach ($this->_groupCollection as $group) {
            if ($website->getId() != $group->getWebsiteId()) {
                continue;
            }
            $groupShow = false;
            foreach ($this->_storeCollection as $store) {
                if ($group->getId() != $store->getGroupId()) {
                    continue;
                }
                if (!$websiteShow) {
                    $options[] = ['label' => $website->getName(), 'value' => []];
                    $websiteShow = true;
                }
                if (!$groupShow) {
                    $groupShow = true;
                    $values = [];
                }
                $values[] = [
                    'label' => str_repeat($nonEscapableNbspChar, 4) . $store->getName(),
                    'value' => $store->getId(),
                ];
            }
            if ($groupShow) {
                $options[] = [
                    'label' => str_repeat($nonEscapableNbspChar, 4) . $group->getName(),
                    'value' => $values,
                ];
            }
        }
    }

    return $options;
}

I added this

$options[] = ['label' => '', 'value' => ''];

The empty value is added but how to set it as default?

Please help.


texts: Magento 2 Sending emails triggered by observer

texts:
I'm trying to send emails using observer triggers, but I'm having problems with _transportBuilder (I can't get TransportBuilder instance).
I'm catching customer_save_after_data_object event and calling my custom class (it's working), but when I try to execute $transport = $this->_transportBuilder... I found issues.

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $vars = array();

    $transport = $this->_transportBuilder
        ->setTemplateIdentifier(1) // My email template
        ->setTemplateOptions( [
            'area' => \Magento\Framework\App\Area::AREA_FRONTEND, // this is using frontend area to get the template file if admin then \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE
            'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
        ])
        ->setTemplateVars($vars)
        ->setFrom('test@test.com', 'Test')
        ->addTo('abc@def.com', 'Somepeople')
        ->getTransport();
    $transport->sendMessage();
}

Result:

  Fatal error: Uncaught Error: Call to a member function
  setTemplateIdentifier() on null in /opt/bitnami/apps/magento/htdocs/app/code/Company/mail/Observer/SendMail.php:62
  Stack trace:

  #0 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73):
  Company\mail\Observer\SendMail->execute(Object(Magento\Framework\Event\Observer))

  #1 /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61):
  Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Company\mail\Observer\SendMail),
  Object(Magento\Framework\Event\Observer))

  #2
  /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Event/Manager.php(66):
  Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array,
  Object(Magento\Framework\Event\Observer))

  #3 /opt/bitnami/apps/magento/htdocs/var/generation/Magento/Framework/Event/Manager/Proxy.php(95):
  Magento\Framework\Event\Manager->dispatch('customer_save_a...', Array)

  #4 /opt/bitnami/apps/magento/htdocs/vendor/magento/mo in
  /opt/bitnami/apps/magento/htdocs/app/code/Company/mail/Observer/SendMail.php
  on line 62

Comments:

I've tried to start setting "TemplateOptions" or "TemplateVars" and
 I've got the same problem. I believe the error is with the instance not found.

Links (Questions followed):

Magento2- Send custom transactional emails
how to send custom email no template in magento2?


texts: Magento2: How to get quote item through item id?

texts:
I want to get quote item through the item id on the guest page.

Got the null value

<?php
namespace Codism\Csr\Block\Index;

class Approveitem extends \Magento\Framework\View\Element\Template {

protected $_coreRegistry;

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Framework\Registry $coreRegistry,
    \Magento\Quote\Model\Quote\ItemFactory $quoteItemFactory,
    \Magento\Quote\Model\ResourceModel\Quote\Item $itemResourceModel
)
{
   $this->_coreRegistry = $coreRegistry;
   $this->quoteItemFactory = $quoteItemFactory;
   $this->itemResourceModel = $itemResourceModel;
   parent::__construct($context);
}

public function getCustomerCartDetails(){
    $itemId = $this->_coreRegistry->registry('itemId');

    $quoteItem = $this->quoteItemFactory->create();
    $item = $this->itemResourceModel->load($quoteItem, $itemId);

    return $item;
}
}


texts: Update disable product quantity programmatically in magento 2.1.X

texts:
How to update disable product quantity programmatically.
Below code update product quantity which are in enable status.
Any one help me for this one.

Here is my code.

 public function updateStock($productId,$productQty)
{
    $product = $this->productFactory->create()->load($productId);

    if($product->getStatus() == 2){ // 2 => Disable , 1 => Enable

        $product->setStatus(1);

        if($product->getStatus() == 1){
            $product->setStockData([
                'use_config_manage_stock' => 0, //'Use config settings' checkbox
                'manage_stock' => 1, //manage product stock
                'is_in_stock' => 1, //Stock Availability
                'qty' => $productQty
            ]);

            $product->setQuantityAndStockStatus([
                'qty' => $productQty,
                'is_in_stock' => 1
            ]);
        }

        $product->setStatus(2);

        try {
            $product->save();
            echo 'Quantity update of SKU => '.$product->getSku().'
';
        } catch (Exception $e) {
            echo $e->getException();
        }

    }else{

        $product->setStockData([
            'use_config_manage_stock' => 0, //'Use config settings' checkbox
            'manage_stock' => 1, //manage product stock
            'is_in_stock' => 1,
            'qty' => $productQty
        ]);

        $product->setQuantityAndStockStatus([
            'qty' => $productQty,
            'is_in_stock' => 1
        ]);

        try {
            $product->save();
            echo 'Quantity update of SKU => '.$product->getSku().'
';
        } catch (Exception $e) {
            echo $e->getException();
        }
    }
}


texts: How we can use Js Mixins for order scripts.js

texts:
I want to override switchPaymentMethod from module-sales/view/adminhtml/web/order/create/scripts.js for that I use mixins:

  app/code/Vendor/Module/view/adminhtml/requirejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_Sales/order/create/scripts': {
                'Vendor_Module/order/create/scripts-mixin': true
            }
        }
    }
};

  app/code/Vendor/Module/view/adminhtml/web/order/create/scripts-mixin.js

define(function () {
    'use strict';

    var mixin = {
        switchPaymentMethod: function(method){
            console.log('funcion called');
            //Main Code
        },
    };

    return function (target) {
        return target.extend(mixin);
    };
});

I got this error in console: Cannot read property 'extend' of undefined

I also tried with override AdminOrder.prototype = { }

Any help would be appreciated...!


texts: Magento 2 : How to Override Admin Template File

texts:
I'm developing a custom module in magento 2.
I need to change the file located in Magento/Sales/view/Adminhtml/Templates/Items/Column/name.phtml.

How can I override file in custom extension?


texts: I am doing an android application which uses Magento as a back end processing system. Now i can display the products in XML format once the user clicks on the product image. Which restful service call do I have to make? Can anybody tell me the restful service calls so that my transaction in mobile will work completely?


texts: How to get system config values in controller ? Magento 1

texts:
I am trying to get system values
using this but not getting the expected values
Mage::getStoreConfig('web/cookie/cookie_httponly');

Any thoughts ?


texts: Class inheritance question in magento (google analytics)

texts:
In a custom module I'm inserting universal analytics so I have to change a few functions from Ga.php file

In Ga.php there is:

class Mage_GoogleAnalytics_Block_Ga extends Mage_Core_Block_Template
{
//google analytics functions
}

If I do like this:

class Custom_Module_Block_Universalanalytics extends Mage_GoogleAnalytics_Block_Ga{
//a couple of functions that I change from Ga.php
}

it doesn't work.

But if I do like this:

class Custom_Module_Block_Universalanalytics extends Mage_Core_Block_Template{
//all functions from Ga.php plus the ones that I change
}

it does work.

So my question is why wouldn't it work if I extend the Mage_GoogleAnalytics_Block_Ga class which already has all the functions?

Update: Here is my config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custom_Module>
            <version>0.1.0</version>
        </Custom_Module>
    </modules>
    <global>
        <blocks>
            <universalanalytics>
                <class>Custom_Module_Block</class>
            </universalanalytics>
        </blocks>
        <helpers>
            <universalanalytics>
                <class>Custom_Module_Helper</class>
            </universalanalytics>
        </helpers>
        <models>
            <universalanalytics>
                <class>Custom_Module_Model</class>
            </universalanalytics>
        </models>
    </global>
    <frontend>
        <events>
            <checkout_onepage_controller_success_action>
                <observers>
                    <universalanalytics_order_success>
                        <class>universalanalytics/observer</class>
                        <method>setUniversalanalyticsOnOrderSuccessPageView</method>
                    </universalanalytics_order_success>
                </observers>
            </checkout_onepage_controller_success_action>
            <checkout_multishipping_controller_success_action>
                <observers>
                    <universalanalytics_order_success>
                        <class>universalanalytics/observer</class>
                        <method>setUniversalanalyticsOnOrderSuccessPageView</method>
                    </universalanalytics_order_success>
                </observers>
            </checkout_multishipping_controller_success_action>
        </events>
        <layout>
            <updates>
                <universalanalytics>
                    <file>universalanalytics.xml</file>
                </universalanalytics>
            </updates>
        </layout>
    </frontend>
</config>

Thanks!

Update: Folowing the comments, indeedthe issue is with this function:

protected function _toHtml(){
    if (!Mage::helper('universalanalytics')->isUniversalanalyticsAvailable()) {
        return '';
    }
    return parent::_toHtml();
}

Mage::helper('universalanalytics')->isUniversalanalyticsAvailable() is returning true, but, as I read here https://stackoverflow.com/questions/11179732/overwritten-block-appears-in-addition-to-module-overwrite return parent::_toHtml(); will return the google classic analytics object.


texts: My footer doesn't come out! "Fatal error: Class 'Mage_Icategory_Helper_Data' not found in /home/sample/public_html/app/Mage.php

texts:
My site, when I click on product detail page,
my footer doesn't come out and instead, error msg comes out on the footer part

  Fatal error: Class 'Mage_Icategory_Helper_Data' not found in
  /home/xxx/public_html/app/Mage.php on line 546

How Can I fix this issue?


texts: how to change address information format in invoice, shipment and credit memo?

texts:
I want to change the address information format in shipment, invoice, and credit memo. Right now the format is Magento address information format like this

I want to display the area and subdistrict. I tried to check the core file. And for displaying the account and order and address information is bundled in this line <?= $block->getChildHtml('order_info') ?>. I find out about the parent class of this block to check the getChildHtml but I have not found the root class to bundle all those information. anyone knows how Magento bundle all of this information? or is there another way to change this address information format?


texts: Customer custom attribute not saving while creating customer programmatically in magento 2.1.11

texts:
I am using following code to create customer in magento 2 programmatically

namespace PackageName\ModuleName\Helper;
use Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$state = $objectManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');

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

// here $total_obj is customer array i am getting from third party service
foreach($total_obj as $arr){
    $customer = $customerFactory->create();
    $customer->setWebsiteId($websiteId);
    $customer->setEmail('customeremail@mail.com');
    $customer->setFirstname('FirstName');
    $customer->setLastname('LastName');
    $customer->setPassword('123456789');
    $customer->setLoginEmail('test@gmail.com');
    $customer->save();
}

from the above code i am not able to set login_email value. all details getting saved but not this custom attribute is not saving.

Please let me know what i am doing wrong.

for creation custom attribute i had followed https://webkul.com/blog/how-to-create-customer-custom-attribute-in-magento-2-0/


texts: I want to log all the query that affect only specific table. For example catalog_product_flat_1. So if query makes update, delete or insert operation to this table it should be logged. It cаused by deleting column sku from time to time from this table and I want to find out the reason.


texts: How to add multiple products at once in the shop cart?

texts:
I have made a new Magento shopping store .I want my customers can to add multiple products at once in the shop cart, is this possible ?
can anyone help me ?


texts: How do I place a widget in a custom page layout?

texts:
I've created multiple custom pages like a contact page and FAQ page but both the pages and the containers I've labeled don't show up in the widget panel.
What's the right way to add widgets to your custom pages?


texts: Add new cronjob to run specific .php file

texts:
I use AOE Scheduler to manage my cronjobs in Magento.

Now I want to run a specific .php file that I created, to run every night at 03.00h.

How can I add this easily?


texts:
how can i access the spConfig variable in a custom function on product view page.

<script type="text/x-magento-init">

    {
                "#product_addtocart_form": {
                    "configurable": {
                        "spConfig": {"attributes":{"93":{"id":"93","code":"color","label":"Color","options":}},
                        "gallerySwitchStrategy": "prepend"
                    }
                }
            }
    }

</script>

when i try to log the

var sp_config = $('#product_addtocart_form').data();
console.log(sp_config);

the console log shows the following screen, and i have to access the option prices,


texts: Understanding getChildHtml('totals') ?> Magento 1

texts:
I've been working into magento 1 to understand some of its concepts & relations.
I can see that the order total section in admin (re-order page)
is made up of

<?php echo $this->getChildHtml('totals') ?>

Is there in - app/design/adminhtml/default/default/template/sales/order/create/data.phtml
I can see this file is called in sales.xml with
<block type="adminhtml/sales_order_create_data" template="sales/order/create/data.phtml" name="data">

I am not sure how these (Subtotal,Gift cards,Total) is rendered.
Actually I want to add converted base total there.
Any thoughts from where the details are coming for these (Subtotal,Gift cards,Total) ?


texts:
I want to get response from API.

    function curlExec($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    $result = curl_exec($ch);
    curl_close($ch);

    $obj = json_decode($result);
    $code = $obj[0]->errormessage;
    if($code == "Success"){
        echo "work";
        exit;
    }else{
        echo "not";
        exit;
    }

}

I am used above code but its return  NULL value.


texts: How can show root url all product in single page?

texts:
I don't have advanced level magento code edit anyway I can do it.
My website need to add menu all product show link(link name: All Product).
All product added to mobiles.

Category tree are same like below

 - Mobiles (root category)
     - iphone(category)
        - iphone 11 (product)
        - iphone 9 (product)
     - samsung (category)
        - galaxy 9 (product)
        - galay 11 (product)

This category page works fine that main reason

  catalog -> manage category -> iphone(category) select -> General
  Information -> URL key

I can't find out Mobiles (root category) under URL key form.
How can I get same like url key in  Mobiles (root category).
How can design all product show single page using with Mobiles (root category).


texts:
Well folks, I need a way to grab the full contents of the wishlist and then log them for examination.

What's the best way to do this?


texts: Magento 2 cart rule conditions and action to exclude specific product using sku

texts:
I have added cart rule and its working properly, I need to exclude specific product from cart rule and others to go with cart rule.

EX: sku1 need to exclude from cart rule.

  1.Only "sku1" in the cart - No need to add cart rule.

  2.Other products only (no sku1 product) - Need to add cart rule

  3.Sku1 and other products - Add cart rule only to other products price value, exclude sku1.

please give some ideas to handle condition and action options.


texts:
I'm having an issue with Magento not processing script tags correctly:

This code:

echo $this->getChildHtml('addthisJs');

adds this script tag:

but on the page it seems to regards the "//" as a comment and then the rest of my html gets eaten by the script tag:


texts: How to get url for static image file in Magento2 javascript files?

texts:
Say you have a js file in your module: MyModule/view/frontend/web/js/. How would you reference the image found in MyModule/view/frontend/web/images/?

A solution would be this one, but looks wrong and inserts global variables:

<script>
    window.imgpath = '<?php echo $block->getViewFileUrl('images/image.png') ?>';
</script>

and reading that variable from window in *.js:

function someFunction() {
    var imgPath = window.imgpath;
}

Update, using with widgets:

#template.phtml:
<script type="text/x-magento-init">
    {
        "*": {
            "mywidget": {

                "marker_image": " <?php echo $block->getViewFileUrl('images/map_pin.png'); ?> "

            }
        }
    }
</script>

in my mywidget.js:

define([
    'jquery',
    'jquery/ui'
], function ($) {
    'use strict';
    $.widget('company.mywidget', {

    _create: function(){
        console.log(this.options.marker_image); //OUTPUTS THE RIGHT VALUE IN THE CONSOLE
        return this.options.marker_image; //THIS IS THE BIT THAT DOESN'T WORK
    },
   test_string: "this appears fine" //IF IT IS A STRING THEN IT IS FINE

});

return $.company.mywidget;

});

in my main js file where all comes together:

require([
        'jquery',
        'mywidget'
    ],
    function($,mywidget){

    $(document).ready(function(){

        data = new mywidget();

        console.log(data) // returns an object where I cannot find my paramater, but test_string is there.


texts: Magento 2 change language for all in Front-end

texts:
I have Magento 2.3.3 I created 3 store views French, English, and Turkish

I need to translate  product descriptions and all Categories is changed the store view. This on the french store.
On the French Store, I would like to change the Description from English to French. Same problem in all other stores.

Thanks


texts: How to include the URLs Magento search results in sitemap.xml or generate a new sitemap.xml for this?

texts: I wonder how I can do to generate a new sitemap.xml on Magento whit only the search results, like Wordpress does, generating more urls to send to Google and increasing the ranking search results for users?


texts: Programmatically creating attributes in Magento 1.9.1

texts:
I am making a simple plugin that creates few example products/categories and attributes for the customers to see as an example when they start they online shop using Magento. It creates everything but has some problems with attributes.

The problem is, that attribute is created, it is added to the default set and is shown in the products and Magento admin system. But when I try to save the product, the attribute value is not saved unless I first go to the attribute and re-save it manually.

Here is my attribute creation code:

private function createAttribute()
{
    $attribute = Mage::getModel('catalog/resource_eav_attribute');
    $_attribute_data = array(
        'attribute_code' => 'demo_size',
        'is_global' => '1',
        'frontend_input' => 'select', //'boolean',
        'default_value_text' => '',
        'default_value_yesno' => '0',
        'default_value_date' => '',
        'default_value_textarea' => '',
        'is_unique' => '0',
        'is_required' => '1',
        'apply_to' => '0', //array('grouped')
        'is_configurable' => '1',
        'is_searchable' => '0',
        'is_visible_in_advanced_search' => '1',
        'is_comparable' => '1',
        'is_used_for_price_rules' => '0',
        'is_wysiwyg_enabled' => '0',
        'is_html_allowed_on_front' => '1',
        'is_visible_on_front' => '0',
        'used_in_product_listing' => '0',
        'used_for_sort_by' => '0',
        'frontend_label' => 'Demo Size',
        'option' => array(
            'value' => array(
                'optionone' => array('XXL'),
                'optiontwo' => array('L'),
                'optionthree' => array('S'),
            ),
        ),
        'default' => array(
            'optionthree'
        )
    );

    $attribute->addData($_attribute_data);
    $attribute->setAttributeSetId(4);
    $attribute->setAttributeGroupId(7);
    $attribute->setEntityTypeId(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId());
    $attribute->setIsUserDefined(1);

    try {
        $attribute->save();
        $this->attId = $attribute->getId();
    } catch (Exception $e) { echo '
Sorry, error occured while trying to save the attribute. Error: '.$e->getMessage().'
'; }
}

So am I missing something when the attribute is created, or is there anything else I have to do, so that the attribute would work properly without me having to re-save it manually?


texts: Magento 2.1 : How to extend Product listing in your custom product list and apply SKU Filter

texts:
I have a Custom module which have customer mapped with certain products , I want to show a custom listing of those products with layered navigation

After Extending product list block in my custom block and changing

public function getLoadedProductCollection()
    {
             return $this->_getProductCollection()->addAttributeToFilter('sku',array('nin'=> $this->getSku()));
    }

On list.phtml

$_productCollection = $block->getLoadedProductCollection();
print_r($_productCollection->getData());
echo"
";

give a Filter collection, But when i Iterate it with

foreach ($_productCollectionTest as $_productTest) {
    echo"
";
    print_r($_productTest->getData());
    echo"
";
}

I get a unfiltered Result


texts: php file_exists (and is_file and is_readable) not working once cache is enabled

texts:
I have developed a theme for a clients magento installation which allows manually uploaded files to be used in catalog/product/view/media.phtml. This is so I can use srcset to load higher resolution images.

The code uses file_exists() to see if the imagery has been uploaded before displaying a placeholder if nothing is present.

As soon as I turn enable the caches, the file_exists() function returns false and my placeholder is shown. If I disable the caches, the correct images return.

I have tried using relative paths as well as getcwd() and $_SERVER['DOCUMENT_ROOT'] to no avail. I have tried the same code with is_file() and is_readable() to no avail.

I have output the calculated path within the cached template to verify that the path it has generated is correct.

The only thing stopping the images from loading is enabling the caches which shaves 2 seconds off the load time so is definitely desirable.

Am I missing something or is this a bug?

Magento CE 1.9.1.0

PHP 5.4

Code:

<?php
$_product = $this->getProduct();
$_helper = $this->helper('catalog/output');
$images = $this->getGalleryImages();

$tehurl = $_product->getProductUrl();
$suburl = substr($tehurl, strrpos($tehurl, "/") + 1);
$suburl = str_replace("-", "", $suburl);
?>

<?php if (file_exists($_SERVER['DOCUMENT_ROOT']."/assets/front/saleimg/productview/tp-1x/".$suburl."-0.png")) { ?>

<?php for ($x = 0; $x <= 2; $x++) { ?>

<img src="/assets/front/saleimg/productview/tp-1x/<?php echo $suburl."-".$x; ?>.png" srcset="/assets/front/saleimg/productview/tp-2x/<?php echo $suburl."-".$x; ?>.png 2x" />

<?php } ?>

<?php
}
elseif (file_exists($_SERVER['DOCUMENT_ROOT']."/assets/front/saleimg/productview/".$suburl.".jpg")) {
?>
    <img src="/assets/front/saleimg/productview/<?php echo $suburl; ?>.jpg" srcset="/assets/front/saleimg/productview/<?php echo $suburl; ?>-2x.jpg 2x" />
<?php
}
elseif (count($images) > 0) {
    $i = 0;
    foreach ($this->getGalleryImages() as $_image):
        if ($this->isGalleryImageVisible($_image)):
?>
    <img id="image-<?php echo $i; ?>" src="<?php echo $this->getGalleryImageUrl($_image); ?>" />
<?php
        endif;
        $i++;
    endforeach;
}
else {
?>

<?php } ?>

<?php echo $this->getChildHtml('after');


texts: Add text to email template if order contains virtual product

texts: I am thinking of selling tickets using the virtual product function. Therefore I would like to add text to the email template only if an virtual product is present. Is this possible?


texts: How to hide price options on Configurable Product?

texts:
I try to hide the price (in the screenshot +4,20€) on my Magento 2.3 but it doesn't work. I want only T2 display and not T2+4,20€.

I read and test a lot of posts too like but not working on my Magento 2.3.

Magento 2: how to hide ''price' of custom option in configurable product

Magento 2.2.3 - Remove price from select field on product page

Can someone help me to do this ?

Thanks.


texts: Magento 2.1.8 : Redirect to localhost for admin URL after update

texts:
After a update I can not login anymore to the admin backend. I had this issue several times after an update but until now could resolve it with the common tips (wipe static data, cleaup all caches, rebuild static content etc.). But this time I am stuck.

I tried to debug the problem but did not get too far up to now. Does nobody else have this issue?

I have URL Server rewrites enabled. index.php is called with my admin path. And then the redirect to some magic localhost path happens. Due to the fancy software architecture of Magento 2 it is very difficult to figure out what is going on just from looking at the code, even with using ack grep.

The database entries for web/unsecure/base_link_url and web/secure/base_link_url are correct with trailing slash. The shop frontend page works without any problems, with and without ssl.

Could you point me to some manuals or give tips how I can enable more extensive logging in magento.

E.g. enable some debug log to pin down what happens. Please no magic tricks ala erase that and that. I really whant to understand what is going wrong here once and for all. Next step is to disable server side URL rewrites but I doubt that fixes anything because index.php is called with the right arguments.

Thanks for your help.


texts: Magento Multisite (Subfolder) Blank Page

texts:
Today, I want to creat a new Website (Multisite - Subfolder method) for my Magento Page. (I'm working on a running Server).

What I have done:

I Created a new Root - Subcategory (store2)
I created a new Webstide in Magento/System/Configuration/Manage Stores
(I'm working on a running Server):

Website     ->      name: mystore2    ,            code: mystore2

Store       ->      name: Main Store  ,   ROOT Category: store2

Store View  ->      name: English     ,            code: mystore2_en
                 ,Status: enabled

I created Subfolders on my Root Server --> name: en
Changed URL Secure & Unsecure:

BASE URL: http://mydomain.at/en/

I copied index.php and .htaccess to my subfolder
Changed Index.php Codes --- My Codes:

$mageFilename = MAGENTO_ROOT . 'app/Mage.php';
$maintenanceFile = 'maintenance.flag';
$compilerConfig = MAGENTO_ROOT . 'includes/config.php';
if (file_exists($compilerConfig)) {
include $compilerConfig;

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Mage::run('mystore2', 'website');

Now, I got a blank Page...
Hope anyone can help me!


texts: Magento 1.9 - Load external script async the right way

texts:
How can I load external scripts async (and preferably also defer). I know I can add attributes to local scripts like this:

<action method="addJs"><script>js/script.js</script><params>async defer</params></action>

But how do I load external scripts? The method above does not work for external scripts.


texts: Magento 2 - controller block not displaying template

texts:
I want my module controller to show content inside of store layout (eg show header, then my controller data, then footer, so it will look like being part of the store, not on a blank page). I created a block with template to achieve this, but I didn't made it working.

I wanted to be sure I did everything right, so I used mage2gen to make a test module

  https://mage2gen.com/load/9e9a75ed-e70f-4438-87fc-fce992cc07a0

and I have the same results. When I open the controller url, store header and footer is shown, but the inner part is blank - everything inside template file is ignored.
First I thought it's just not displayed, so I waited for the page to finish loading and then searched the for some text from the template in page source (developer tools -> elements), but it's not here. Like if the template was blank.

I runned magento setup:upgrade and cache:flush multiple times, but no changes. The var/log has nothing related in here (only debug.log is printing cache_invalidate as always)

What is wrong here? Did I messed up my store, or is mage2gen not working properly?


texts:
I am facing a problem with the invoice email in magento 2. What is happening is that when I finalize an order, the payment confirmation email is already sent even though the payment is not confirmed. In the email box the customer immediately receives the email with the order details and the invoice email confirming the payment.
Could anyone help me understand what may be going on? Where should I start the analysis? In reality I would like to know exactly what happens at the back end at that moment, because unexpectedly my store is sending the invoice email when finishing the order.
If you have any tips for a young person just starting out in this Magento world, please tell me.
Thanks ...


texts: Varien Autoloader thinks my module's observer lives in Mage/

texts:
I inherited a couple of Magento installs with custom observers to handle integration with SAP B1. The B1 parts I get, but Magento keeps throwing curveballs at me that I just can't get good answers about. I have searched on SE, and found a few people with the same error messages, but none of their fixes/causes seem to be affecting me.

Whenever cron.php runs, I get the following 3 errors every time:

2015-02-25T00:30:02+00:00 ERR (3): Warning: include(Mage/CompanyName/AutomatedImport/Model/Observer.php): failed to open stream: No such file or directory  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93
2015-02-25T00:30:02+00:00 ERR (3): Warning: include(Mage/CompanyName/AutomatedImport/Model/Observer.php): failed to open stream: No such file or directory  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93
2015-02-25T00:30:02+00:00 ERR (3): Warning: include(): Failed opening 'Mage/CompanyName/AutomatedImport/Model/Observer.php' for inclusion (include_path='/chroot/home/shop/shop.companyname.com/html/app/code/local:/chroot/home/shop/shop.companyname.com/html/app/code/community:/chroot/home/shop/shop.companyname.com/html/app/code/core:/chroot/home/shop/shop.companyname.com/html/lib:.:/usr/share/pear:/usr/share/php')  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93

The problem is, my modules are located exactly where they are supposed to be in app/code/local/CompanyName/AutomatedImport, and not under Mage/. I've got another Magento install for a different shop that uses almost the exact same modules (they maybe vary by 5 lines of non-important code) and that one works fine.

Has anyone run into this before? I have a feeling it's some stupid capitalization issue somewhere in my module/etc/config.xml or in app/etc/modules/CompanyName_AutomatedImport.xml but I can't for the life of me find anything that tells me that what I have is in any way wrong. I've been attempting to do due diligence on this for the past week and a half, but I just don't know enough about Magento. All of the SO fixes I've seen involve either problems in the xml that I don't have, or moving modules/Magento installs into different directories/servers, which I haven't done.

Any help would be most appreciated, as I am way past stumped.

Module config.xml

app/etc/modules xml file

Things attempted:

Turning on/off caching
Clearing the cache(s)
Turning on compilation mode, and turning it back off
Checking the permissions on my module


texts: Magento 2- How to Import cross sell products with CSV?

texts:
I have many products in my Magento2 store. I want to assign one product as cross sell product of all products.
Is there any way to assign cross sell product with CSV product import ?


texts: How to upgrade magento ver 2.3.1 to 2.3.3

texts:
I'm in live, need to upgrade Magento 2.3.1 to 2.3.3.
Please let me know, how to upgrade this version without any disturbance of my website.


texts: Programmatically create static block and add it to selected store views

texts:
I need to create static blocks programmatically. How to assign a block to selected store views?

I've found tutorials about creating static blocks, but they all add the block to all store views, like this:

public function createCmsBlock()
{
    // $this->blockFactory is of type: \Magento\Cms\Model\BlockFactory
    $cmsBlock = $this->blockFactory->create();
    $cmsBlock->setIdentifier('block-identifier')
        ->setTitle('Block Title')
        ->setContent('Block Content')
        ->setIsActive(true)
        ->setStores([0]);
    $cmsBlock->save();
}

As far as I understand the line ->setStores([0]); adds the block to all store views. But how to force it to add our block only to selected store views? And how to retrieve list of such store views?


texts: Magento2: I wanted to save order details to my local database

texts:
I wanted to Save Orders from magento 2 to my local database or another database when new order is placed in Magento frontend.

I need to Save the order details when the new order is placed in magento 2 OR is there any other alternative way to save Orders to a different database.

Please let me know what is the ideal way of saving Orders or Do I have to create a module and place a schedule Cron to check the new orders on every 2 or 3 hours.

Please help me to get started in right direction.

Thanks in advance.


texts: How I can set different theme for the category list page?

texts: I want to set separate theme which is applied only for a specific page, for example, category list page only rest of the all the page has a different theme.


texts:
In my current webstore created in OpenCart, the customers email is the coupon code, so when a customer subscribes to our newsletter for a 5% discount they can use their email at the checkout page, and 5% of the order amount will automatically be subtracted.

Is it possible to have a system like this in Magento 2? I can see that coupon codes and price rules are a standard functionality in Magento 2, but this doesn't seem to be a part of it.

Thanks.

Any help is greatly appreciated.


texts: How to use React.js on front end with magento 2.4

texts: Hello guys I'm completely new to Magento and the only thing i want to ask is how can use React.js on the frontend of a magento webshop?


texts: Add block in layout XML only for one store view

texts:
I have a Magento 2.1.x installation with two store views.
I would like to show a particular block in the footer only for one store view.

In Magento 1.9.x I would have done it in this way:

<STORE_storecode>
    <reference name="lorem_ipsum">
        <block type="..." />
    </reference>
</STORE_storecode>

How can I achieve that in Magento 2?


texts: Update styling magento 2 in production mode

texts:
I have a server with a production install of magento.
When I deploy a new version, adding for example a new .less file, the new markup doesn't get loaded. I cleared the cache, rebuild the static-content. Only after switching to developer mode the changes are loaded.
This process, switching back and forth between dev and prod causes a goot 10 minutes downtime.
Can someone explain this? What is the proper way to update css, or anything, for magento 2 in production?
Thank you


texts: M1 - Efficient Bulk Update Order Attribute

texts:
The problem

I have added a custom attribute to the sales_flat_order table like:

/* @var $installer Mage_Sales_Model_Mysql4_Setup */
$installer = new Mage_Sales_Model_Mysql4_Setup('setup');

$installer->addAttribute(
    Mage_Sales_Model_Order::ENTITY,
    'new_attribute_code',
    array(
        'type' => 'varchar',
        'visible' => true,
    )
);

I would like to programmatically do a bulk update of orders to set a new value for this attribute against many orders. This value will be scripted to update based on the result of another system, it's not a "one off" or solved by having a default value.

I hoped Magento would have a similar kind of interface as it does for products which allows for bulk updates like

Mage::getSingleton('catalog/product_action')->updateAttributes(
    $productIdsArray,
    array('description' => 'New desc'),
    Mage_Core_Model_App::ADMIN_STORE_ID
);

However, I can find no such interface. Does anyone know an efficient and safe way to bulk update orders?

Research

Product bulk update

The product bulk update seems to boil down to Mage_Catalog_Model_Resource_Abstract::_saveAttributeValue. This won't help me for Mage_Sales entities. I could however use it as inspiration for a direct sql level access. However this is something I would hope Magento handles.

Order bulk cancel

I know that you can mark many orders as "cancelled" through the mass action in the magento admin panel. However under the hood it is in fact doing

public function massCancelAction()
{
    $orderIds = $this->getRequest()->getPost('order_ids', array());

    foreach ($orderIds as $orderId) {
        $order = Mage::getModel('sales/order')->load($orderId);
        if ($order->canCancel()) {
            $order->cancel()
                ->save();
        }
    }

That is pretty grim. It's not even loading all the orders in a collection before trying to cancel. It's calling load within a for loop. Ew.

Does anyone know of anything clever I can be doing here?

Responses

@Raphael thanks for your answer. Popping this in my entities' resource model seemed to work okay.

private function getOrderTable()
{
    return $this->getTable('sales/order');
}

public function updateOrders(array $orderIds, $value)
{
    if (empty($orderIds) || !is_string($value)) {
        return $this;
    }

    $adapter = $this->_getWriteAdapter();
    try {
        $adapter->beginTransaction();

        $data  = array(
            'new_attribute_code' => $value,
        );

        $condition = $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . ' IN(?)', $orderIds);
        $this->_getWriteAdapter()->update($this->getOrderTable(), $data, $condition);

        $adapter->commit();
    } catch (Exception $e) {
        $adapter->rollBack();
        throw $e;
    }

    return $this;
}


texts: Localize Attributes (storeview values) programmatically

texts:
Because i have many options (read 10k+) for some of the attributes, it is a real pain to update/change/add the attribute titles on a per storeview base. Mostly it is not even possible to save the attributes.
Is there a way to do it programmatically or by plain sql?


texts: Admin form save date format, month and day wrong way around

texts:
I have created a new custom form/grid with a date field, I've also set up a table with the 'date' field to match.

$this->addColumn('date', array(
  'header'    => Mage::helper('ifactory_document')->__('Date'),
  'width'     => '150px',
  'index'     => 'date',
  'type'      => 'date',
  'format'    => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
));

...

$fieldset->addField('date', 'date', array(
    'label' => 'Date',
    'required' => FALSE,
    'name' => 'date',
    'image' => $this->getSkinUrl('images/grid-cal.gif'),
    'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
    'value' => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT))
));

The format in the grid & form is "d/MM/YYYY" and in the database it is in the format "YYYY/MM/d"

However before it is saved in the database it is converted to "MM/d/YYYY" format. If I save 4/5/2015 (4th of May) it will appear in database as 2015/4/5 (5th of April) any day values above 12 cause a failure.

I have tried inputting date directly into database and that has worked but saving still reproduces the issue. I have also checked configuration setting suggested in this post, as well as clearing magento cache but the issue still exists.


texts:
I have created a custom module. In which I want to use data modifier. I have written this code but it gives the following error:

  Missing required argument $modifiers of Magento\Ui\DataProvider\Modifier\Pool

My Code is Like
di.xml

<virtualType name="Vendor\Module\Ui\DataProvider\Customer\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool">
    <arguments>
        <argument name="modifiers" xsi:type="array">
            <item name="customer" xsi:type="array">
                <item name="class" xsi:type="string">Vendor\Module\Ui\DataProvider\Customer\Form\Modifier\Customer</item>
                <item name="sortOrder" xsi:type="number">120</item>
            </item>
        </argument>
    </arguments>
</virtualType>
<type name="Vendor\Module\Ui\DataProvider\Customer\Form\Modifier\CustomerDataProvider">
    <arguments>
        <argument name="pool" xsi:type="object">Vendor\Module\Ui\DataProvider\Customer\Form\Modifier\Pool</argument>
    </arguments>
</type>
<type name="Vendor\ModuleUi\DataProvider\Customer\Form\Modifier\Customer">
    <arguments>
        <argument name="scopeName" xsi:type="string">customer_form.customer_form</argument>
    </arguments>
</type>

CustomerDataProvider.php

namespace Vendor\Module\Ui\DataProvider\Customer\Form;

use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory;
use Magento\Ui\DataProvider\AbstractDataProvider;
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
use Magento\Ui\DataProvider\Modifier\PoolInterface;
/**
 * DataProvider for product edit form
 */
class CustomerDataProvider extends AbstractDataProvider
{
    /**
     * @var PoolInterface
     */
    private $pool;
    /**
     * @param string $name
     * @param string $primaryFieldName
     * @param string $requestFieldName
     * @param CollectionFactory $collectionFactory
     * @param PoolInterface $pool
     * @param array $meta
     * @param array $data
     */
    public function __construct(
        $name,
        $primaryFieldName,
        $requestFieldName,
        CollectionFactory $collectionFactory,
        PoolInterface $pool,
        array $meta = [],
        array $data = []
    ) {
        parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
        $this->collection = $collectionFactory->create();
        $this->pool = $pool;
    }
    /**
     * {@inheritdoc}
     */
    public function getData()
    {
        /** @var ModifierInterface $modifier */
        foreach ($this->pool->getModifiersInstances() as $modifier) {
            $this->data = $modifier->modifyData($this->data);
        }
        return $this->data;
    }
    /**
     * {@inheritdoc}
     */
    public function getMeta()
    {
        $meta = parent::getMeta();
        /** @var ModifierInterface $modifier */
        foreach ($this->pool->getModifiersInstances() as $modifier) {
            $meta = $modifier->modifyMeta($meta);
        }
        return $meta;
    }
}

modifier file Customer.php

<?php
namespace Vendor\Module\Ui\DataProvider\Customer\Form\Modifier;

use Magento\Ui\DataProvider\Modifier\ModifierInterface;
/**
 * Class Prices
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class Customer implements ModifierInterface
{
    /**
     * {@inheritdoc}
     */
    public function modifyMeta(array $meta)
    {
        return $meta;
    }

    /**
     * {@inheritdoc}
     */
    public function modifyData(array $data)
    {
        return $data;
    }
}

I can't find where it is missing arguments. Please correct way to add modifiers.

Note - I am adding this modifier for customer edit form


texts: How to display only first option of attribute - magento

texts:
I have a certain product with multiselect attribute "year", for the product selected options - 2003,2004,2005.

I use this code - to display a list of options.

<?php echo $_product->getResource()->getAttribute('year')->getFrontend()->getValue($_product) ?>

This code returns - 2003,2004,2005.

Is it possible to get only the first option?

I need to display only option "2003".

Please help!


texts: Reset orders / invoices - 1.9.2.4 - Database error

texts:
I´ve a big problem with the reset of my test orders / invoices.

I run this mySQL command in phpMyAdmin on my database:

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE sales_flat_creditmemo;
TRUNCATE sales_flat_creditmemo_comment;
TRUNCATE sales_flat_creditmemo_grid;
TRUNCATE sales_flat_creditmemo_item;
TRUNCATE sales_flat_invoice;
TRUNCATE sales_flat_invoice_comment;
TRUNCATE sales_flat_invoice_grid;
TRUNCATE sales_flat_invoice_item;
TRUNCATE sales_flat_order;
TRUNCATE sales_flat_order_address;
TRUNCATE sales_flat_order_grid;
TRUNCATE sales_flat_order_item;
TRUNCATE sales_flat_order_payment;
TRUNCATE sales_flat_order_status_history;
TRUNCATE sales_flat_quote;
TRUNCATE sales_flat_quote_address;
TRUNCATE sales_flat_quote_address_item;
TRUNCATE sales_flat_quote_item;
TRUNCATE sales_flat_quote_item_option;
TRUNCATE sales_flat_quote_payment;
TRUNCATE sales_flat_quote_shipping_rate;
TRUNCATE sales_flat_shipment;
TRUNCATE sales_flat_shipment_comment;
TRUNCATE sales_flat_shipment_grid;
TRUNCATE sales_flat_shipment_item;
TRUNCATE sales_flat_shipment_track;
TRUNCATE sales_invoiced_aggregated;
TRUNCATE sales_invoiced_aggregated_order;
TRUNCATE sales_payment_transaction;
TRUNCATE sales_order_aggregated_created;
TRUNCATE sales_order_tax;
TRUNCATE sales_order_tax_item;
TRUNCATE sendfriend_log;
TRUNCATE tag;
TRUNCATE tag_relation;
TRUNCATE tag_summary;
TRUNCATE wishlist;
TRUNCATE log_quote;
TRUNCATE report_event;
ALTER TABLE sales_flat_creditmemo AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_comment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_creditmemo_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_comment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_invoice_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_address AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_payment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_order_status_history AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_address AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_address_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_item_option AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_payment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_quote_shipping_rate AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_comment AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_grid AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_item AUTO_INCREMENT=1;
ALTER TABLE sales_flat_shipment_track AUTO_INCREMENT=1;
ALTER TABLE sales_invoiced_aggregated AUTO_INCREMENT=1;
ALTER TABLE sales_invoiced_aggregated_order AUTO_INCREMENT=1;
ALTER TABLE sales_payment_transaction AUTO_INCREMENT=1;
ALTER TABLE sales_order_aggregated_created AUTO_INCREMENT=1;
ALTER TABLE sales_order_tax AUTO_INCREMENT=1;
ALTER TABLE sales_order_tax_item AUTO_INCREMENT=1;
ALTER TABLE sendfriend_log AUTO_INCREMENT=1;
ALTER TABLE tag AUTO_INCREMENT=1;
ALTER TABLE tag_relation AUTO_INCREMENT=1;
ALTER TABLE tag_summary AUTO_INCREMENT=1;
ALTER TABLE wishlist AUTO_INCREMENT=1;
ALTER TABLE log_quote AUTO_INCREMENT=1;
ALTER TABLE report_event AUTO_INCREMENT=1;
SET FOREIGN_KEY_CHECKS=1;

But i always get this error:
 #1146 - Table 'db63844xxxx.sales_flat_creditmemo' doesn't exist

I don´t know what i should do. I worked on it the whole day, but i doesn´t work. Please help me.


texts:
i am add some extra fee in cart on base of some special conditions.It's work fine all all place in magento but now i think about add this fee to paypal standard.I am successful but it works only if Transfer Cart Line Items = No.

I want to work it where Transfer Cart Line Items = yes in paypal option.

Now i want one row on paypal bill with fee lable & value.

It can come with tax and item total or items and shipping both option are good for me.
Can any body help me?


texts: How can we setup cart price rule if customer purchase more than one time then first item should have actual price(X) but from second to last item, its price should be less (X-5) ? For example customer A adds three items in cart and base price is 15. So for first item it should be 15 but for next two items it should be 10.


texts: Settings to add programmatically created product to store in multi-store site

texts:
I am trying, unsuccessfully, to add products into a store in a multi-website, multi store site.  I am basing the script on one which works fine on single store projects so I am guessing that the error is down to something like store and website ids or  "current store" settings.  The product appears in the DB and I can load it from a script - however it does not appear in the backend or front end of the site. Can anyone assist in explaining the correct combination of store Ids (or what else I might be missing).

Here is the site/store structure:

Main Website (1)
UK Site (2)
    -> Uk store (2)
EU Site (3)
    -> Spanish store (3)
    -> German store (4)
    -> French store (5)

Here is are the main/important bits of the script.  In this instance I am trying to save the product to the UK site (website id 2) and UK store (store id 2):

Mage::app();
Mage::setIsDeveloperMode(true);
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
//NOTE: have also tried Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(2));
$cstore = Mage::app()->getStore(); //quick check

/* when setCurrentStore is set to 2 $cstore includes:
* [_data:protected] => Array
*       (
*           [store_id] => 2
*           [code] => uk
*           [website_id] => 2
*           [group_id] => 2
*           [name] => UK
*           [sort_order] => 1
*           [is_active] => 1
*       )
*
*    when setCurrentStire is done with ADMIN_STORE_ID, we get this
*
*        [_data:protected] => Array
*        (
*            [store_id] => 0
*            [code] => admin
*            [website_id] => 0
*            [group_id] => 0
*            [name] => Admin
*            [sort_order] => 0
*            [is_active] => 1
*        )
*/

//attributeSetID is  pulled out but for the purpose of this..
$attributeSetId= 4; // default

//dummy item
$item = array("name"=>"test product","id"=>"123456");

//I have tried using setWebsiteId and setWebsiteIds  (and same for storeId)

$this->magObject = Mage::getModel("catalog/product"); //new
$this->magObject ->setTypeId('grouped')
        ->setSku($item["id"])
        ->setAttributeSetId($attributeSetId)
        ->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
        //->setWebsiteIds(array(2))
        ->setWebsiteId(2)
        //->setStoreIds(array(2))
        ->setStoreId(2)
        ->setName($item["name"])
        ->setCreatedAt(strtotime('now'))
        ->setMetaTitle($item["name"])
        ->setMetaDescription('test meta description')
        ->setDescription('This is a long description')
        ->setTaxClassId(0) //tax class (0 - none, 1 - default, 2 - taxable, 4 - shipping)
        ->setPrice(9999.99)
        ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
        ->setWeight(4.0000)
        ->setCreatedAt(strtotime('now'))
        ->setStockData(
            array(
            'is_in_stock' => 1,
            'qty' => 99999,
            'manage_stock' => 0,
            'use_config_manage_stock' => 0
            )
        );

$this->magObject->save();
$newRangeId = $this->magObject->getId(); // this correctly returns the new Id of the product in the DB, which can then be loaded and updated
$this->echoOut(" - New Range ID is ".$newRangeId . " - now updating");

UPDATE:

I added in the code to set the CategoryIds and the items do appear in the admin now - all sorted.  One would think that you could have a product not in a category (yet).


texts: Magento 2 - How can I set the price of a custom option in the system config?

texts: I am needing to add a select to all products that has 2 options. The first option should have the same price on all products that would ideally be set in the system configuration.


texts: Magento 2: Undefined class constant 'PUB' in index.php

texts:
$params[\Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [
    \Magento\Framework\Filesystem\DirectoryList::PUB => [\Magento\Framework\Filesystem\DirectoryList::URL_PATH => ''],
    \Magento\Framework\Filesystem\DirectoryList::MEDIA => [\Magento\Framework\Filesystem\DirectoryList::URL_PATH => 'media'],
    \Magento\Framework\Filesystem\DirectoryList::STATIC_VIEW => [\Magento\Framework\Filesystem\DirectoryList::URL_PATH => 'static'],
    \Magento\Framework\Filesystem\DirectoryList::UPLOAD => [\Magento\Framework\Filesystem\DirectoryList::URL_PATH => 'media/upload'],
];


texts: Import products via SOAP and reuse the same image for all products

texts:
I've created a script to import many hundred products from another datasource via SOAP to magento but I want to use the same product image for all products.
Is this possible?


texts:
Magento 1.9 Sales Order grand total showing value 0

Does my table affect?


texts:
I have an instance of \Magento\Quote\Model\Quote\Item $item

I need to get the order ID of the order in which that particular item has been purchased.

For full disclosure, I am using a plugin function called afterConvert,
which operates around the function "convert" in

Magento\Quote\Model\Quote\Item\ToOrderItem

Anyway, the table for quote_item doesn't seem to have the order_id in it.

Any idea how I could go about it?

public function aroundConvert(
    \Magento\Quote\Model\Quote\Item\ToOrderItem $subject,
    \Closure $proceed,
    \Magento\Quote\Model\Quote\Item $item,
    $additional = []
) {
    $order = null;

    $item->getQuote();

    $options = $this->configurationHelper->getOptions($item);

    foreach ($options as $option){
        if($option['label'] == 'Clarity'){
            $clarity = $option['value'];
        }
        if($option['label'] == 'Color'){
            $color = $option['value'];
        }
        if($option['label'] == 'Shape'){
            $shape = $option['value'];
        }
        if($option['label'] == 'Carat'){
            $carat = $option['value'];
        }
    }
    /** @var \Magento\ConfigurableProduct\Api\Data\ConfigurableItemOptionValueInterface $option */

    $qrcode = $this->qrcodeFactory->create();
    $orderID = $item->getOrderId();

But $item->getOrderId doesn't work.


texts: Magento2 add breadcrumb dynamically on custom pages

texts:
Magento2 How can I add breadcrumb dynamically on custom pages?
Home > FAQ > Carpet FAQ
Home > FAQ > Shutters FAQ

Where Carpet & Shutters are dynamic


texts: Problem in overriding ListProduct on search results

texts:
We have overwritten Magento\Catalog\Block\Product\ListProduct to be able to check if displayed products match a certain category.

We have set the preference in our module /etc.di.xml like this:

<preference for="Magento\Catalog\Block\Product\ListProduct"
            type="Vendor\ModuleName\Block\Catalog\ListProduct"/>

And we have overwritten the ListProduct Class like this:

namespace Vendor\ModuleName\Block\Catalog;

class ListProduct extends \Magento\Catalog\Block\Product\ListProduct
{
protected $_customerSession;
protected $categoryFactory;

public function __construct(
    \Magento\Catalog\Block\Product\Context $context,
    \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
    \Magento\Catalog\Model\Layer\Resolver $layerResolver,
    \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
    \Magento\Framework\Url\Helper\Data $urlHelper,
    array $data = [],
    \Magento\Customer\Model\Session $customerSession,
    \Magento\Catalog\Model\CategoryFactory $categoryFactory
) {
    $this->_customerSession = $customerSession;
    $this->categoryFactory = $categoryFactory;
    parent::__construct(
        $context,
        $postDataHelper,
        $layerResolver,
        $categoryRepository,
        $urlHelper,
        $data
    );
}

protected function _getProductCollection() {
...
}
...

Problem:

The problem is that this class overrides ListProduct on all category pages except on search result page, where it still uses Magento\Catalog\Block\Product\ListProduct and not te overwritten one.

How can we overwritte ListProduct class for search results page?


texts: Magento 1.9 Google site map generation 404 error

texts:
I'm using magento 1.9.x version, recently i tried to generate google site map via

Catalogue - > Google Site Map

But it gave 404 error

Then i checked the code and identify the location of error here

/public_html/app/code/core/Mage/Sitemap/Model/Sitemap.php

Line No 165

Mage::dispatchEvent('sitemap_categories_generating_before', array(
            'collection' => $categories
        ));

When i comment out above code site map generates fine. In surface i can't see any side effect of comment that code,

Does anyone know will that effect for other functions of my site,