texts: Coupon code Discount should apply for MRP instead of selling price

texts:
Currently after applying coupon code, discount is applied to selling price. but we want Discount to be applied for MRP and not for selling price.

Example :

MRP = 200   , Selling Price = 175
Coupon code discount =  10%

so how Default magento works is = > 10% for 175 [final price = 157.5 ],

but what i need is 10 % for 200. [final price = 180 ]

so i tried below code as mentioned in this link,

now what i am getting : 175- 20 = 155 as final price

but What i need is : 200- 10 = 180 as final price

is there any Module to achieve this  or what code i need to change to get result?

    $item=$observer['item'];
    $rule=$observer['rule'];
    $rule->getDiscountAmount();
    $rulePercent = max(0, 100-$rule->getDiscountAmount());
    echo "
--pro id---".$item->getProductId();
    //echo "
";
    //print_r($rule->getData());

    if($rule->getSimpleAction()=='by_percent')
    {
        $disPer=$rule->getDiscountAmount();
        $product=Mage::getModel('catalog/product')->load($item->getProductId());

        //echo "
pro price----".$product->getPrice();

        $item->getDiscountAmount();

        $ratdisc=($product->getPrice()*$disPer)/100;
        $DiscountAmount=$ratdisc+$item->getDiscountAmount();
        $item->setBaseDiscountAmount();
        $BaseDiscountAmount=$ratdisc+$item->setBaseDiscountAmount();

        $result = $observer['result'];
        $result->setDiscountAmount($DiscountAmount);
        $result->setBaseDiscountAmount($BaseDiscountAmount);
    }


texts: URL Rewrites doesn't work when ? mark symbol in Magento 2

texts:
I am working on Magento 2 URL Rewrites. All working well expect one. In my old website have AccountSettings.asp?modwhat=change_b this URL and I am trying to rewrite this, but it doesn't working for me.

Any help on this?


texts: Get the content of terms and conditions by url?

texts:
I know this is how you get the content of Terms and Condition,

<?php if (!$this->getAgreements()) return; ?>
<form action="" id="checkout-agreements" onsubmit="return false;">

<?php foreach ($this->getAgreements() as $_a): ?>

        <div id="agreement-block-<?php echo $_a->getId();?>" class="agreement-content <?php if (Mage::helper('opc')->getTermsType()):?>hidden<?php endif?>"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
            <?php if ($_a->getIsHtml()):?>
                <?php echo $_a->getContent() ?>
            <?php else:?>
                <?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
            <?php endif; ?>

                <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" />
                <a class="button-cart-simple button-agreement" data-id="<?php echo $_a->getId();?>" data-toggle="modal" data-target="#myModal"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->htmlEscape($_a->getCheckboxText()) ?>

<?php endforeach ?>

</form>

But can I access this page by using URL?


texts: magento 2.3.1 inventory:reservation missing commands

texts:
I have inventory_reservation inconsistencies that I need to clean up on M2 2.3.1 so following this wiki guide https://github.com/magento/inventory/wiki/CLI-Reference but when running it I get error

'there are no commands defined in the inventory:reservation namespace".


texts: Magento1.9 Where is frontend design defined if it's not defined in Admin

texts:
I'm working on a Magento 1.9 project, which has 4 different websites.

Each website is using it's own design.

Inside this path public/app/design/frontend/default/, there are different folders (english, german, norwegian, swedish) that are used as design to different website.

And normally we can define which theme a storeview should be using in Admin->System->Design. But this area is empty for this project. So I wonder where else it is defined for these themes, so each website knows which design it should use?


texts:
I have Magento 2.2 and the Track Order button is not working, when I open any order and I press Track Order button I have this error:

Shipment #000000013

Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Phrase::getTracking() in /home/public_html/vendor/magento/module-shipping/view/frontend/templates/tracking/details.phtml:22
Stack trace: #0 /home/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() #1 /home/public_html/vendor/magento/framework/View/Element/Template.php(270): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Framework\View\Element\Template), '/home/public_ht...', Array) #2 /home/public_html/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView('/home/public_ht...') #3 /home/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Framework\View\Element\Template->_toHtml() #4 /home/public_html/vendor/magento/framework/View/Layout.php(558): Magento\Framework\View\Element\AbstractBlock->toHtml() #5 /home/public_html/vendor/magento/frame in /home/public_html/vendor/magento/module-shipping/view/frontend/templates/tracking/details.phtml on line 22

In that file details.phtml at the line 22 I have this code:

$number = is_object($track) ? $track->getTracking() : $track['number'];

How I can fix this?

Thanks


texts:
How does magento profit as a company?

If the community version is 100% free and they don't take a percent fee from extensions or add ons sold

I know they charge for enterprise edition but is this the only way they earn money?

Thanks


texts: How to programmatically create multiple CMS pages at once?

texts:
I am working in Magento 2 and I am needing to create multiple CMS pages all at one time. I am trying to set up an Install script to do this all at once. Every tutorial and search that I look up shows how to create one CMS page programmatically but I've searched everywhere and haven't found a single one showing how to create multiple at the same time. Is this even possible?

I have created a custom module with an InstallData script that looks like this:

namespace <VendorName>\<ModuleName>\Setup;

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

class InstallData implements \Magento\Framework\Setup\InstallDataInterface
{
    private $_pageFactory;

    public function __construct(\Magento\Cms\Model\PageFactory $pageFactory)
    {
        $this->_pageFactory = $pageFactory;
    }

    public function install(ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();

        $page = $this->_pageFactory->create();

        $page1 = $page->load('page1', 'identifier');
        if ($page1->getId()) {
            $page1->setContent('
This is it!
')->save();
        } else {
            $page->setTitle('Page 1')
                ->setIdentifier('page1')
                ->setIsActive(true)
                ->setPageLayout('1column')
                ->setStores(array(0))
                ->setContent('
This is it!
')
                ->save();
        }

        $page2 = $page->load('page2', 'identifier');
        if ($page2->getId()) {
            $page2->setContent('
This is it!
')->save();
        } else {
            $page->setTitle('Page 2')
                ->setIdentifier('page2')
                ->setIsActive(true)
                ->setPageLayout('1column')
                ->setStores(array(0))
                ->setContent('
This is it!
')
                ->save();
        }

        $page3 = $page->load('page3', 'identifier');
        if ($page3->getId()) {
            $page3->setContent('
This is it!
')->save();
        } else {
            $page->setTitle('Page 3')
                ->setIdentifier('page3')
                ->setIsActive(true)
                ->setPageLayout('1column')
                ->setStores(array(0))
                ->setContent('
This is it!
')
                ->save();
        }

        $setup->endSetup();
    }
}

This does not throw any errors, but when I enable the module it only creates the first page 'page1' and doesn't create any of the others. Please help.


texts:
I want to apply table rates shipping based on price AFTER DISCOUNT in Magento 2.

For Ex. Here(https://prnt.sc/o4albv) is shipping apply on Subtotal amount $2676.

I want to Shipping apply on (Subtotal)-(Discount) = remaining amount

Ex. $2676 - $1070.40 = $1605.60


texts:
I would like to know what happens when we click on "pay with bitcoin" button.
I have no idea how am i supposed to make my payment.
I have been going through coingate's documentation but i couldn't find use of pay with bitcoin button. any kind of help would be appreciated.

NB: I'm aware that we can make our payment against the bit coin address given.
But i would like to make my payment by clicking on that button.


texts: Magento 2 : How to change the currency symbol wise price in list.phtml page?

texts:
I will trying but its not working ?

<?php
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of Object Manager
    $currencyModel = $objectManager->create('Magento\Directory\Model\Currency'); // Instance of Currency Model
    $price =$block->getProductPrice($_product);

    $currencyCode = 'SAR';
    $currencySymbol = $currencyModel->load($currencyCode)->getCurrencySymbol();
    $precision = 2;
    echo $formattedPrice = $currencyModel->format($price, ['symbol' => $currencySymbol, 'precision'=> $precision], true, false);
    var_dump($formattedPrice);
?>

How to solve this problams?


texts: can't login and see frontend after installing an extension

texts:
I was installing an extension and it failed. Now the page is not loading and showing following error....   Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.  After deleting maintenance.flag it shows another error.... Fatal error: Call to a member function extend() on a non-object in /home/wwwthema/public_html/lib/Varien/Simplexml/Config.php on line 600 ... Please give the solution  http://themaorishop.co.nz/


texts: Option ID is shown instead of option value

texts:
As a German Shop we need to echo delivery time into the top of the productpage and the product grid. Normaly it does what it should, but in our latest installation it shows the option id instead of its value. ...same version 1.7.0.

This is the code:

echo $this->getProduct()->getDeliveryTime();

This is not working, too:

$_product_helper = Mage::helper('catalog/output');
echo $_product_helper->productAttribute($this->getProduct(), $this->getProduct()->getDeliveryTime(), 'delivery_time');

Even no other option value is shown there, no matter which attribute I try to echo. It just shows the correct option id. In other sections, e.g. under Additional Information it shows the right value.

Why does the same code do different things?
And what could be the cause for that?


texts: Magento2 error when trying to create a record in db

texts:
I have the following resource model.

namespace Vendor\Gift\Model\ResourceModel;

class GiftInformation extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    protected function _construct()
    {
        $this->_init('gift_products', 'gift_id');
    }

And the following model:

namespace Vendor\Gift\Model;

class Gift extends \Magento\Framework\Model\AbstractModel
{

    public $giftId;

    public function __construct(
            $giftId = null
    ){
        $this->giftId = $giftId;
        $this->_init('Vendor\Gift\Model\ResourceModel\GiftInformation');
    }

    }
}

When I do

$this->_giftFactory = $this->_giftFactory->create(['giftId'=>$this->giftId]);

I can use  $this->_giftFactory->setData([..some data..]) and  $this->_giftFactory->getData() methods of the factory, but when I try
 $this->_giftFactory-save(), so that I can insert a row in my table "gift_products" I receive the following error:

Uncaught Error: Call to a member function dispatch() on null in
/magento_root_dir/vendor/magento/framework/Model/AbstractModel.php:661
......
... rest of the stack trace, which just leads to the place where I invoke the save() method.

On line 661 in AbstractModel.php I have :

$this->_eventManager->dispatch('model_save_before', ['object' => $this]);

What is the problem here ?


texts: extension not found : intl and no php.ini

texts:
I am trying to install Magento in it's own sub folder (shop) and get the message:

  Required PHP extension not found : intl

I don't have any php.ini files on my server, except the one I have put in my Wordpress folder.

I read, that what I should do is create a php.ini and put in extension=php_intl.dll but where do I put it?

The Magento installation want to create a folder so I can't premake a folder for it.


texts: How can I display best sellers top 4 on catalog view by default in grid display with the option to see all the products?

texts:
I have been tasked to display the top 4 best selling products as a default view in Magento. After clicking a button the user should then be able to see the rest of the products.
Bestsellers should be calculated dynamically.
How can I achieve this?
There is no existing module available for this, am I correct?
What resources are good to help me to quickly understand Magento module building?
Any assistance would be appreciated.


texts:
My magento version is ver. 1.9.1.0.

We saw a blank page at /checkout/cart after applying SUPEE-10570 and compiling. Just to clarify: With deactivated compiler all things went well, with activated compiler we only could see a blank cart page when logged in without any log entries (even after activating all possible logs and developer mode).

Cause:

the function getPasswordTimestamp will invoke two times when logged in and visit /checkout/cart.
disabled compiler both invocation work.
enable compiler only the first invocation work, second invocation failed.

can anyone explain and give the good solution?

getPasswordTimestamp function in Mage_Customer_Helper_Data

public function getPasswordTimestamp($customerId)
{
    /** @var $customer Mage_Customer_Model_Customer */
    $customer = Mage::getModel('customer/customer')
        ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
        ->load((int)$customerId);
    $passwordCreatedAt = $customer->getPasswordCreatedAt();

    return is_null($passwordCreatedAt) ? $customer->getCreatedAtTimestamp() : $passwordCreatedAt;
}


texts: I want to add an extra amount if the payment method is cash on delivery

texts: I have an E-commerce website where i want the users to pay extra some money if they choose "Cash on delivery" as payment option. Can you please help me achieve this? Thanks in advance


texts: I need to show the product sku in two places on the product page in Magento 2

texts:
I'm trying to show the product sku in two different places on the product page. Is this possible and if so how can I do it?
The sku is currently further down the page but I would also like to display it in product.info.main section as shown in the screenshot.


texts: Magento API v2 regarding inserting shipment numbers and tracking numbers

texts:
I am  new to magento and its web services,
Can any body help me to insert multiple records at single request by consuming magento web services through other applications(Eg: Dynamics Nav ERP system).
Actually when we send multiple records by given method salesOrderShipmentAddTrack in to magento to insert Tracking numbers, it is able to send only single record .
So is there any need to change any settings are change the method code or else anywhere.
Please any body can help this.
Thanks in advance.


texts:
I'm wondering on what Magento CE version to work on for a new project.

I'm pretty confident with Magento 1.9.x versions, had some issues but already know what to do with most of them. I'm thinking that the unknown issues will result to complete loss of time and possibly it will feel like starting all over.

I haven't built anything on Magento for more than a year, so I'm not sure what has changed. I'm not a developer for what it's worth.


texts: Magento show Address fields and validate registration form only under some conditions

texts:
I'm trying to customize the form for customer account creation and I would like to use the same form for different types of customers, i.e. private and companies.
What I want to achieve is using the same form for both and show different fields according to the choice of the user: if user choose 'private' he has to fill in some fields, if he chooses 'company', additional fields - for the address and VAT - are shown.

So I've enabled address fields in the local.xml and they're correctly shown or hidden, depending on which button (private or company) is chosen.

The problem is that if I simply hide the address fields, form is validated also on those fields, unless I put a

$this->setShowAddressFields(false);

just before the

if($this->getShowAddressFields()): ?

to hide address fields and suppress validation.
I've also put

<input type="hidden" name="create_address" value="0" />

to skip addresss fields validation.

So I've tried with jquery to change the setShowAddressFields whenever the user click the button to choose its type, something like

        $('#choose-type button').click(function(){
            if($(this).val() == 'private'){
                $(this).addClass('selected');
                $('#choose-type button').last().removeClass('selected');
                $('.required-company').removeClass('visible');
                <?php $addrEnabled = $this->setShowAddressFields(false) ?>

            }else{
                $(this).addClass('selected');
                $('#choose-type button').first().removeClass('selected');
                <?php $addrEnabled = $this->setShowAddressFields(true) ?>
                $('.required-company').addClass('visible');
            }
        });

I've also tried to show two different forms, in the same template, one with $this->setShowAddressFields(false) and the other with $this->setShowAddressFields(true) and show/hide the right form, and validate with Varien the right form, like this

var dataForm = new VarienForm('form-validate', true);
var dataFormbis = new VarienForm('form-validate-bis', true);

but still no luck.

So it is possible to achieve something like this in the same template, or I have to forcedly create two different templates?


texts: when i add category it give me this "Secondary Description" attribute value is empty"

texts: Suddenly Magento starts giving this error ... I tried to var_dump() what is missing, also check the file but there is no problem with it.


texts: Magento 2 Mass Delete Cannot read property 'total' of undefined

texts:
I tried to perform mass delete on my custom UI grid but it gives me error in console "Cannot read property 'total' of undefined" i don't understand whats wrong with my code, my gride code is given below

<listingToolbar name="listing_top">
        <massaction name="listing_massaction">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">

                    <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
                    <item name="indexField" xsi:type="string">id</item>
                </item>
            </argument>
            <action name="delete">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">delete</item>
                        <item name="label" xsi:type="string" translate="true">Delete</item>
                        <item name="url" xsi:type="url" path="*/*/massDelete"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Delete Post</item>
                            <item name="message" xsi:type="string" translate="true">Are you sure you wan't to delete selected items?</item>
                        </item>
                    </item>
                </argument>
            </action>
        </massaction>
        <bookmark name="bookmarks"/>
        <columnsControls name="columns_controls"/>
        <filterSearch name="fulltext"/>
        <filters name="listing_filters" />
        <paging name="listing_paging"/>
        <exportButton name="export_button"/>
    </listingToolbar>
    <columns name="spinner_columns">
        <selectionsColumn name="id">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="indexField" xsi:type="string">id</item>
                </item>
            </argument>
        </selectionsColumn>

In console it gives me error like


texts: Add Field to Customer Registation Form Magento 2

texts:
I want to add a field/attribute to Customer Registration Form on frontend.
And I create a folder in my module , the folder is "Setup" and I put inside a file "InstallData.php" but this doesn't work.
this is the code:

<?php
namespace Riccardo\Plugin\Setup;

use Magento\Customer\Model\Customer;
use Magento\Customer\Setup\CustomerSetup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

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

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

        $installer->addAttribute("customer", "promotion_code",  array(
            "type"     => "varchar",
            "backend"  => "",
            "label"    => "Promotion Code",
            "input"    => "text",
            "source"   => "",
            "visible"  => true,
            "required" => true,
            "default" => "",
            "frontend" => "",
            "unique"     => false,
            "note"       => ""

        ));

        $attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "promotion_code");

        $used_in_forms=array();

        $used_in_forms[]="adminhtml_customer";
        $used_in_forms[]="checkout_register";
        $used_in_forms[]="customer_account_create";
        $used_in_forms[]="customer_account_edit";
        $used_in_forms[]="adminhtml_checkout";
        $attribute->setData("used_in_forms", $used_in_forms)
            ->setData("is_used_for_customer_segment", true)
            ->setData("is_system", 0)
            ->setData("is_user_defined", 1)
            ->setData("is_visible", 1)
            ->setData("sort_order", 100)
        ;
        $attribute->save();

        $installer->endSetup();
    }
}

After this I update the release of moduel and run this command from prompt:

  php bin/magento setup:upgrade

Maybe this command is wrong ?
The source code is wrong?
What is wrong?

Please help me


texts: Magento 2 get Simple product url from configurable

texts:
I am extending Magento_ProductAlert module. By default when subscribing to product it saves configurable product id but I have managed to get selected simple product ID. And later I know that I can get my product url by $product->getProductUrl() but in this case it doesn't work for me because simple products are not visible individually, only in configurable products and using that it returns me link to simple product like this - http://mysite/myproduct-123 but is there a way how can I retrieve configurable product url but with attributes that respond to my simple product? I mean like this - http://mysite/myconfigurableproduct#123=12

Thank you!

When sending email to user that he has subscribed to product I am using this -

<?php if ($_products = $block->getProducts()): ?>
    <?php foreach ($_products as $_product): ?>

<?= __('Hello!') ?>

            <?= __(
                'You have subscribed for product: %2',
                $_product->getProductUrl(),
                $block->escapeHtml($_product->getName())
            )
            ?>

            <a href="<?= $block->getUserUnsubscribeUrl() ?>">
                <?= __('Click here to stop alerts for this product.') ?>

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


texts: Send email depending on selected option in Contact form

texts:
I have created a custom select in contact form (Contact Us page). Is it possible to send an email to a different email address depending of the selected option? i.e. if i choose 'Area 1' the email is sent to area1@mail.com, if i choose 'Area 2' is sent to area2@mail.com and so on.

I have seen that the email address to which the email is sent is obtained from system.xml in contact module.

The trace i have made is:

/Magento/Contact/Controller/Index/Post.php

$transport = $this->_transportBuilder
            ->setTemplateIdentifier($this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, $storeScope))
            ->setTemplateOptions(
                [
                    'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
                    'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
                ]
            )
            ->setTemplateVars(['data' => $postObject])
            ->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
            ->addTo($this->scopeConfig->getValue(self::XML_PATH_EMAIL_RECIPIENT, $storeScope))
            ->setReplyTo($post['email'])
            ->getTransport();

I understand that in the code above is where the transport object is created to send the email. I also know that the email is defined in the next piece of code:

->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))

The value of that constant is 'contact/email/sender_email_identity'.

So, following that path to the system.xml i encountered the field sender_email_identity.

In there, they use a source model to obtain the email.

<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>

In the Identity.php file is the toOptionArray( ) function.

/**
 * Retrieve list of options
 *
 * @return array
 */
public function toOptionArray()
{
    if ($this->_options === null) {
        $this->_options = [];
        /** @var $section \Magento\Config\Model\Config\Structure\Element\Section */
        $section = $this->_configStructure->getElement('trans_email');

        /** @var $group \Magento\Config\Model\Config\Structure\Element\Group */
        foreach ($section->getChildren() as $group) {
            $this->_options[] = [
                'value' => preg_replace('#^ident_(.*)$#', '$1', $group->getId()),
                'label' => $group->getLabel(),
            ];
        }
        ksort($this->_options);
    }
    return $this->_options;
}

Yet, i don't know how to proceed from there.


texts:
I have a "Website" and 8 "Stores" attached to this "Website"

Whenever an order is processed through any of the "Store" i want the order to reflect in following way.

"Website" should be able to see the orders of all stores in the "Order" history with option to filter order by Stores.
"Store" should only see his order.

How does Magento handles this internally ? or any Magento extension support this architecture ? i tried searching and installing the Magento instance to try it by myself, but i am having hard time figuring this out, any help is greatly appreciated.

Thanks


texts: Magento2 : Add simple product with custom options To cart Rest API

texts:
hello I need to Add simple product with custom options To cart throw Rest API I succeeded t add the simple product , price is correct and every thing is ok but unfortunately I didn't succeed  to add custom options
here is my code I'm using Curl:
<?php
//****************** get the token ********************//
$magentoURL = "https://--------.----------.org/";
$station = "fr";
$data = array("username" => "*******", "password" => "*********");
$data_string = json_encode($data);
$ch = curl_init($magentoURL . "index.php/rest/" . $station . "/V1/integration/admin/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Length: " . strlen($data_string)));
$token = curl_exec($ch);
$token = json_decode($token);

$headers = array("Authorization: Bearer " . $token);
//************************* find the customer ***********************************//
$customeremail = 'email@gmail.com';

$ch = curl_init($magentoURL . '/rest/' . $station . '/V1/customers/search?searchCriteria[filter_groups][0][filters][0][field]=email&searchCriteria[filter_groups][0][filters][0][value]=%25' .
    $customeremail . '%25&searchCriteria[filter_groups][0][filters][0][condition_type]=like');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token));
$result = curl_exec($ch);
$customer = json_decode($result, true);
//************************* if customer exist ***********************************//
if ($customer['total_count'] != 0) {
    $id = $customer['items'][0]['id'];
    $ch = curl_init($magentoURL . "rest/" . $station . "/V1/carts/mine");
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $body = '{
    "quote": {
        "items": [{
            "sku": "mysku-sku",
            "qty": 1,
            "name": "Reservation 2020",
            "price": 320,
            "product_type": "simple",
            "product_option": {
                "extension_attributes": {
                    "custom_options": [{
                            "option_id": "8227",
                            "option_value": "5"
                        }
                    ]
                }
            }
        }],
        "customer": {
            "id": '. $id.',
            "email": "email@gmail.com",
            "firstname": "firstname",
            "lastname": "lastname"
        }
    }
';
// set body
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . $token));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
// send the request and save response to $response
    $response = curl_exec($ch);

// stop if fails
    if (!$response) {
        die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
    }
    echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
    echo 'Response Body: ' . $response . PHP_EOL;
// close curl resource to free up system resources
    curl_close($ch);
}

the response :
HTTP Status Code: 200
Response Body: []
but nothing in my cart


texts: Magento2 PWA Layered navigation for desktop change to on page

texts:
Magento2 PWA layered navigation. Inn PWA desktop the layered navigation filter is in hemburger menu popup. I need to set that on page same a magento list page layered navigation.
How can I achieve that?
Something like https://www.ukmeds.co.uk/general-health/face-masks


texts: In my Shipment Method there is no quotes shown when I select for United Kingdom

texts: Here I have posted a image where in shipment method there is no quotes available for united kingdom


texts: issue in Mage::registry('current_category'), return only the same value for whole category pages

texts:
When its come to Mage::registry('current_category'); is a common question.

After searching several pages,stack exchange and stack overflow i feel to post this question as i am unable to find a solution for this.and willing to get some advice to get from the helping mind in the community.

I want to update different content for different category pages in my website.

I use this code to get the current category and define the footer contents.

I added this code in to my footer.phtml and echo the $footer_content

$current_category = Mage::registry('current_category')->getName();
if($current_category=='All Deals'){
    $footer_content ="Content #1";
}
if($current_category=='Food & Dining'){
    $footer_content ="Content #2";
}

this code segment always return the one value for different category pages.
What is the issue i am facing,it will be great pleasure if some one can explain any possible suggestion to fix this issue.


texts: Which model file in magento , fetch data from catalog_product_entity_text?

texts:
How to fetch data from table catalog_product_entity_text?

This table contains the description of product according to store view (english, french, german).
I want to know that which core file fetch data from this table


texts: Cloudfront Redirects to Origin only when Static Content Signing is Enabled

texts:
I'm using AWS CloudFront with Magento 2.4.
When dev/static/sign is disabled, I have absolutely no issues with the CDN.
When dev/static/sign is enabled though, all static resources are redirected to the origin url.
I've tried this and this, with no success.
Has anyone encountered this?


texts: Trying to find certain fields on the magento database without success

texts:
I was trying to find some fields because i want to obtain all the products and then, make a query but i was not able to do that(they dont appear in the database diagram for Magento 1.9):

This is the diagram:

https://anna.voelkl.at/uploads/magento/ce1922.png

I only found the fields "SKU" and "min_sale_qty". What happened to the others?

Do these fields : code_brand, code_business_unit, code_line, code_group, code_business even exist or they were created by someone?

Anyway, i am using MYSQL connected to the MAGENTO database.


texts: How to customize classes fo sublevel menu items

texts:
I've been looking around for a while and couldnt find a solution to my problem.

I need to add classes to submenu li items.

I've tryed to figure out editing Topmenu.php and Navigation.php (both inside core/Mage/Catalog and Core/Mage/ )

It looks kind of like this now

link

link

sublink

sublink

sublink

link

And thats what I need it to look like:

link

link

sublink

sublink

sublink

link


texts: Magento 2 is generating the product url with catalog/product/view/id instead of product name

texts:
We are having a strange problem in our Magento 2 webshop. Our webshop has different ways of generating the product url. So some of our products just show the product url as it should be /name-of-the-product and others show it with the following structure:

domain.com/catalog/product/view/id/2221/name-of-the-product

And then we have a third way and that is that it includes the category id in the url like:

domain.com/catalog/product/view/id/5856/s/name-of-the-product/category/899

We would all products like to be just with the name of the product so:

domain.com/name-of-the-product

We tried setting up the search engine optimization settings by configuration / catalog / catalog as shown in the first answer and shown in the image blow, but this did not work:

We also tried setting up the search engine settings by configuration / general / web / Search engine optimization as shown in the printscreen below, but this also does not work.

You can see what is happening on https://www.loungeset.nl/accessoires/tuinmeubelhoes. If you scroll a bit down to for instance to AeroCover bbq hoes ø52cm - antraciet you see what is happening

Has anyone a idea how this comes?


texts: How to check configurable product have size option?

texts: If the configurable product has size, I want to add a size guide for it. But how can I check that product have the size or not?


texts: Magento 2 : How to get total review count and get ratings percentage

texts:
In Magento 2, I need to get details of how many reviews approved in specific product and how many average ratings percentage of specific product.

How to get this both details ?

Please help me.

Thanks.


texts: what does hasOption do in Mage_Catalog_Block_Product_View class?

texts:
There is a method getJsonConfig() that relies on a property hasOptions(), I don't know when it returns true when it returns false, thank you for your help. (Magento 1.9)

public function getJsonConfig()
{
    $config = array();
    if (!$this->hasOptions()) {
        return Mage::helper('core')->jsonEncode($config);
    }
.....


texts: Magento 2: Approval Status is showing disapproved in sales order listing

texts:
I purchased the one product by PayPal PayFlow. Product purchased successfully but order approval status is showing disapproved.
Any one can tell me the reason why approval status is set disapproved.
See below screenshot:


texts:
While I import a product using csv file, magento2 throw this error

Data validation is failed. Please fix errors and re-upload the file..
Following Error(s) has been occurred during importing process:
Only first 100 errors are displayed here. Download full report
1. Value for '%s' attribute contains incorrect value in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Checked rows: 10, checked entities: 10, invalid rows: 10, total errors: 10

Suggest me How to solve this.


texts: Magento 2 category custom attribute call base url

texts:
In Magento 2 I created Custom attribute as a Textarea then i call that content in particular Category.

So Now My Problem is I want to call base url in that dynamically so that i added like this

 Test but it's not working how to call store url in category custom attribute

it comes like this http://domain.com/admin/cms/wysiwyg/directive/___directive/e3tzdG9yZSB1cmw9ImZydWl0cy12ZWdldGFibGVzLXBsYW50cy9mcnVpdHMuaHRtbCAifX0,/key/36565656sdgfjsdfsdgfhsdyhfuhsdfsghfgsdhfbsd9a185e68/


texts: Magento 2: programmatically run setup upgrade

texts:
My Client wants me to write code to :

programmatically upload a customized module and then
enable the module(php bin/magento module:enable VENDORNAME_MODULENAME) and then
upgrade the system(php bin/magento setup:upgrade).

I successfully did the first 2 steps, but unable to do the 3rd one. Can anyone share sample code to programmatically run setup upgrade in Magento 2?

 <?php
        use Magento\Framework\App\Bootstrap;
        include('../app/bootstrap.php');
        $bootstrap = Bootstrap::create(BP, $_SERVER);
        $objectManager = $bootstrap->getObjectManager();

        $modules = array('VENDORNAME_MODULENAME');
        try{
            // Code to enable the module
            $objectManager->create('Magento\Framework\Module')->setIsEnabled(true,$modules);

            // Code to setup upgrade(php bin/magento setup:upgrade)
            .......

        }catch(Exception $e){
            $msg = 'Error : '.$e->getMessage();die();
        }


texts: Checking Configurable-Child product price types (fixed or percent)

texts:
I have created a printable page of product details and all is working well. The only thing which is failing is checking if the product's child price type is fixed or percent;

I have successfully fetched and checked custom options for the price type as follows;

//get options
            $options = $product->getOptions();

        foreach ($options as $option)
        {
            $o = $option->getValues();

            foreach ($o as $v)
            {
                //if price_type fixed = echo price
                if ($v["price_type"] == "fixed")
                {
                    $optPrice = $v["price"];
                } //else percent = echo product price + %
                else
                {
                    $optPrice = $priceExcTax * ($v["price"]/100);
                }

                //number_format price
                $optPrice = number_format($optPrice, 2);

                //echo price and title

                $output .= $v['title'] . " (+ &pound;" . $optPrice . " + VAT)
";
            }
        }

I hoped this would work in a similar way for child products but I've tried the following with no luck;

$confAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
                        foreach ($confAttributes as $confAttribute)
                        {
                            echo "Choose " . $confAttribute['store_label'] . "...
";

                            foreach ($confAttribute["values"] as $value)
                            {
                                echo $value["label"] . " (+ &pound;";

                                //if price_type fixed = echo price
                                if ($value["price_type"] == "fixed")
                                {
                                    $optPrice = $value["pricing_value"];
                                }
                                else //else percent = product price + %
                                {
                                    $optPrice = $priceExcTax * ($value["pricing_value"]/100);
                                }

                                $optPrice = number_format($optPrice,2);
                                echo $optPrice . " + VAT)
";
                            }
                        }

Having searched a little I've also tried;

if ($value["is_percentage"])

with no luck either.

The price of child products is ALWAYS being seen as fixed, can anyone help?

UPDATE:

I've even looked up the product I am testing in the raw database and can see the 'is_percent' field so I am unsure as to why anything I try is not working.


texts: Magento2: How to changed products filter

texts:
Now the products filter looks like this:

Anyone have solution how to to in this way? (filter in button).


texts:
I created an event observer to report the creation of new magento products, but the observer doesn't work when the products are created by importing Magmi.

My magento version is 1.9.3.9

This is the config.xml

    <global>
        <models>
            <wally_logproductupdate>
                <class>Wally_LogProductUpdate_Model</class>
            </wally_logproductupdate>
        </models>
        <events>
            <catalog_product_save_before>
                <observers>
                    <wally_logproductupdate>
                        <class>wally_logproductupdate/observer</class>
                        <method>beforeSave</method>
                        <type>singleton</type>
                    </wally_logproductupdate>
                </observers>
            </catalog_product_save_before>
        </events>
    </global>

This is the Observer:

class Wally_LogProductUpdate_Model_Observer
{
    protected $isNew = false;

    public function beforeSave($observer)
    {
        $product = $observer->getEvent()->getProduct();
        if ($product->isObjectNew()) {
            $this->isNew = true;
            $this->afterSave($observer);
        }
    }

    public function afterSave($observer)
    {
        $product = $observer->getEvent()->getProduct();
        if ($this->isNew) {
            $name = $product->getName();
            $sku = $product->getSku();
            $price = $product->getPrice();

            Mage::log("[{$name} ({$sku}) {$price}] aggiornato", null, 'product-updates.log');
        }
    }
}

Is it the right way or do I have to work in other ways to import products using magmi?


texts:
I want to retrieve the products under a certain category. Now what I'm trying to do is pass the Category Name and retrieve the actual Category ID. So in return I can use this category id to retrieve the products under this category. My previous code didn't work anymore although it worked previously but now it's not working anymore

Below is my current code

public function getProductsCategoryByName()
{
    $categoryName = "Extra category";
    $categoryCollection = $this->_categoryFactory->create()->getCollection()->addAttributeToFilter('name',$categoryName)->setPageSize(1);

    if ($categoryCollection->getSize()) {

        $categoryId = $categoryCollection->getFirstItem()->getId();

        $category = $this->_categoryFactory->create()->load($categoryId);

        $product_collection = $this->_productCollectionFactory->create()
            ->addAttributeToSelect('*')
            ->addCategoryFilter($category)
            ->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
            ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);

        return $product_collection;
    }

    return null;
}


texts: Magento 2: Convert Magento\Framework\Phrase into string

texts:
How can i convert this variable into string:
$var = __("Welcome");

because when i put in strpos function it will return an error:
strpos($var, 'om');

Uncaught TypeError: strpos() expects parameter 1 to be string, object given strpos(Object(Magento\Framework\Phrase)


texts: After Move project from one server to another server site not working

texts: i have move my project from one server to another server then after site give 500 error .before move i have change base URL , i also change database configuration . still give 500 in front end and back end please guide me for resolve my issue


texts: How to create custom field in Sales > order > create new order Grid?

texts:
I am working on Magento, I want to create new custom field with filter in Sales > Order > Create new order > Add product grid.

Let me know please how can i do it.

Thanks.


texts: Unable to synch with Marketplace after upgrade to 2.2.6

texts:
After upgrading to Magento Community 2.2.6 the setup wizard required me to enter my access keys again.
Every time I try to add my public and private keys from my Magento Marketplace account the server returns the following error:

Invalid response line returned from server: HTTP/2 200

The actual response from the /setup/index.php/marketplace/save-auth-json call
is
{"success":false,"message":"Invalid response line returned from server: HTTP/2 200 \r\n"}

Magento 2.2.6
 Apache/2.4.37
 PHP 7.1


texts: Magento 2.1 Cannot Update Multi-select Attributes for Multiple Products

texts:
Anyone else having this issue? I have created a couple of new attributes (with multi-select) and when I try to mass update this attribute across 9 products simultaneously it doesn't update (although it says it's successful.)

I can update the attribute if I click into each product individually.


texts: Magento2 - How to set stored credit card as default payment method?

texts:
How to set stored Credit Card as selected by default in Magento2?

If multiple cards are listed in the checkout page.


texts: Magento Indexing fails with product price “Cannot initialize the indexer process. ”

texts:
Indexing problem with product price index.

Command Prompt error:

  Product Prices index process unknown error SQLSTATE[21SO1]: Insert value list does not match column list: 1136 column count doesn't match value count at row 1 in

Admin error:

  Cannot initialize the indexer process.

Solution already tried:

Database repair tool.
Rename local.xml and reinstalled Magento.
Indexing using command line.
And other solutions which I got on Google.

Please share if any one having working solution for same.


texts: Magento 2 REST Api update "manufacturer" attribute values

texts:
I try to update the attribute values of the default attribute manufacturer.
It has now empty values and I try to PUT about 500 values.

My address

/host/rest/V1/products/attributes/manufacturer

gives me "Attribute with the same code".

I am pretty sure that PUT is the right option and that I already updated Items with PUT.


texts: Magento 2 - can not get custom attribute in product for add to cart

texts:
I want to add remark input text field in checkout page
I follow Magento 2 - Set custom attribute value on cart page to set custom attribute in quote_item.

In configurable.phtml

            <input type="text" name="remark" id="remark">

In catalog_attribute.xml

<group name="quote_item">
    <attribute name="remark"/>
</group>

In SalesQuoteItemSetCustomAttribute

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $product = $observer->getProduct();
    $quoteItem = $observer->getQuoteItem();
    $quoteItem->setRemark($product->getRemark());
}

But $product->getRemark() is null, inside /checkout/cart/add/ do I need to set remark in product directly from http request?


texts: Magento 2: add admin page content title in layout xml?

texts:
I noticed that you can set the page title in the layout xml per how to modify page title.

but it's not working in the admin - if I want to change the admin page title, in the Controller, this works:

$resultPage->getConfig()->getTitle()->prepend(__('Customers Now Online'));

Is there a way to set the result content page title in the layout xml?


texts: How to keep module enabled across instances in Magento 2?

texts: is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?


texts: How can I Reindexing in Magento 2 on xampp server and My Oprating System is Windows 7.


texts: Obtain all orders from MAGENTO B2B without success

texts:
I wanted to get all orders (B2B) that are stored in MAGENTO database (using SQL) and obtain all the information about them (Items, price, transport information, current status, user information and so on)

I was trying something like this but this is not what i really want:

SELECT ord_items.name, ord_items.sku, ord_items.qty_ordered, ord_items.weight, ord_items.price
FROM sales_flat_order_item as ord_items
WHERE ord_items.product_type = 'configurable' OR ord_items.product_type = 'bundle';

Can help me with this?

This is the MAGENTO database diagram:


texts: Wrong entity ID exception in install script

texts:
I am trying to run this install script but I am getting an exception Wrong entity ID. Tried debugging through debugger but I am not much familiar with the EAV architecture of Magento, so got lost.

Here is the portion of my config.xml

<resources>
    <namespace_mymodule_setup>
        <setup>
            <module>Namespace_Mymodule</module>
            <class>Namespace_Mymodule_Model_Resource_Eav_Mysql4_Setup</class>
        </setup>
        <connection>
            <use>core_setup</use>
        </connection>
    </namespace_mymodule_setup>
    <namespace_mymodule_write>
        <connection>
            <use>core_write</use>
        </connection>
    </namespace_mymodule_write>
    <namespace_mymodule_read>
        <connection>
            <use>core_read</use>
        </connection>
    </namespace_mymodule_read>
</resources>

I have defined the class by extending it from Mage_Eav_Model_Entity_Setup

class Namespace_Mymodule_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {

}

And finally my install script contents are:

<?php

$installer = $this;

$installer->startSetup();

$installer->addAttribute( 'quote_payment', 'b_transaction_id', array() );
$installer->addAttribute( 'order_payment', 'b_transaction_id', array() );
$installer->addAttribute( 'invoice', 'b_transaction_id', array() );
$installer->addAttribute( 'creditmemo', 'b_transaction_id', array() );

$installer->endSetup();

What's the error about? And Its a possibility that this script ran earlier successfully from a different module (this one is a rewrite) but I am not sure if it has then how to check for that?


texts:
I am having a bit of a brain fart here.

I am trying to migrate from 1.9.3.7 to 2.2.6

I have attempted to perform this migration before, and the deltas screwed me up. So now, I have migrated the 1.9 from the old hosting provider to AWS where I can manage the full stack. I then have a new server running as a development server that hosts a 1.9 instance and a 2.2.5 instance.

For whatever reason, I can't seem to process how this is supposed to work with production data.

I feel like I am over thinking it. I was thinking that I needed to have an RO DB but if I did that, then the migration tool would not work to create new tables in the database for the migration, but I also don't want to touch the production data, so I don't want the migration tool touching the old server. But then I feel like I want a 1-way sync from the prod DB to the dev DB, but will it get screwed up with new orders/customers from the prod DB after the sync has been performed?

Any suggestions on what I am missing? I feel like it is just something simple.

Thanks.


texts: client should buy minimum 2 kilo products then and then he should be able to proceed to check out

texts: i have developed a online web store for my client and he has a query that the client (product buyer) should not be able to proceed to check out until he buys minimum 2 kilo product


texts: PayPal gateway has rejected request. Currency is not supported (#10605: Transaction refused because of an invalid argument)

texts:
PayPal gateway has rejected my request. It gives me following error:

  Currency is not supported (#10605: Transaction refused because of an invalid argument. See additional error messages for details).

I am using INR as base currency, and placing order using AUD, but I am getting above error.

Please advise any solution for this issue.

Thanks in advance


texts: Magento2 Event Observer Redirect Simple Product to Configurable Product

texts:
I'm trying to write a module to redirect simple products to their configurable products once each simple product is clicked on. I've done a bit research and wrote an Observer to catch event: controller_action_predispatch_catalog_product_view
Now I'm stuck in getting the clicked product (such as ID), from which I want to get its configurable product URL, then execute the redirect. Here is my Observer/redirect.php:
`

namespace Vendor_name\Module_name\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;

class redirect implements ObserverInterface {

    protected $_catalogProductTypeConfigurable;
    protected $_productloader;

    public function __construct(
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $_productloader,
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable $catalogProductTypeConfigurable,
        \Magento\Catalog\Model\Session $catalogSession,
        \Magento\Framework\App\ResponseFactory $responseFactory,
        \Magento\Framework\UrlInterface $url
    ){
        $this->_productloader = $_productloader;
        $this->_catalogProductTypeConfigurable = $catalogProductTypeConfigurable;
        $this->_catalogSession = $catalogSession;
        $this->_responseFactory = $responseFactory;
        $this->_url = $url;
    }
    public function execute(\Magento\Framework\Event\Observer $observer ) {
        $_product = $observer->getEvent()->getProduct();//this dosen't seem to return anything at all
        $product_id = $_product->getProductId();
        $parentByChild = $this->_catalogProductTypeConfigurable->getParentIdsByChild($product_id);
        //preset product options
        if(isset($parentByChild[0])){
            $id = $parentByChild[0];
            $productCollection = $this->_productloader->create()->load($id);
            $productAttributeOptions = $productCollection->getTypeInstance(true)->getConfigurableAttributesAsArray($productCollection);
            $attributeOptions = array();
            foreach ($productAttributeOptions as $productAttribute) {
                $attributeOptions[$productAttribute['attribute_id']] = $_product->getData($productAttribute['attribute_code']);
            }
        }
        $this->catalogSession->setSuperAttributes($attributeOptions);
        //redirect to configurable product
        $configProductUrl = $parentByChild->getProductUrl();
        $this->_responseFactory->create()->setRedirect($configProductUrl)->sendResponse();
        exit();
    }
}

`


texts:
I am using Magento 2, in my case I want to add an element after another using jQuery, can anyway tell me how to it, the best practice please
For example i want to insert a div with class 'one' after another div with class 'two'
$(".one").insertAfter(".two");

thank you in advance !


texts: Get CatalogInventory stock collection in Observer

texts:
I need, on website save, get the inventory with the current website ID.

Ad I'm trying to get the CatalogInventory Stock Collection in an Observer, but it finish with the error:

Configuration array must have a key for 'dbname' that names the database instance

My Code is:

public function execute(\Magento\Framework\Event\Observer $observer)
{
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $stockCollection = $objectManager->create('\Magento\CatalogInventory\Model\ResourceModel\Stock\Collection');
}

The event is: website_save_after

What is wrong with this?

I used this example:
Magento 2 Get product collection


texts: How to show distance from user location to destination?

texts:
We have a pickup address and google API key. We want to show the approximate location from the user to the destination (pickup address).

How can I do that?

Looking for help!


texts: How to add export button in catalog page Magento 2.1.8

texts: I need to add export functionality in catalog page(which contains all the products).Im using magento 2.1.8 in my project.


texts: Fatal error: Uncaught Error: Call to a member function select() on null.Magento2

texts:
<?php
$connection = $this->getConnection();
$select = $connection->select();
$select = $model->getCollection()
   ->select()
   ->count()
   ->from($this->getDbPrefix() . 'name_table', '*')
   ->where('result', ' likes%');
   return (int)$objectManager->fetchOne($select);
?>

I want SELECT COUNT (*) FROM name_table WHERE result LIKE 'likes%' to be executed, and a numeric value is displayed on the page.How do I do it? I'm a beginner. I'll be very grateful for your help!


texts: display images from cache folder, on new server of existing project

texts: I am trying to setup existing Magento project on the local system and new server. I copied all files of the existing project and set it up the entire project. But, no product images are showing on the front-end or back-end. It is all showing magento placeholder. How should I get product images working on front-end and back-end?


texts: how to check system configuration of modules in admin magento2

texts:
I have installed magento2 with sample data and also installed an "HelloWorld" extension of Amasty.

But I didn't find any link to check module's configuration as we can see in Magento 1.x as - System->Configuration .

But I didn't find any "Configuration" link under "System" tab.
Please let me know how to check this ?


texts: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_id' in 'where clause'

texts: It appears to have this error message on every product page. Any idea about why this happened and how can I fix it? Thanks!


texts:
How get admin url in js file ?
Js file call AjaxController and this Js file are called to System -> Config from system.xml


texts: Exluding images but not updating on frontend

texts:
I have an external script which basically gets a product and excludes all of the images. The script is really simple

include('app/Mage.php');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
error_reporting(E_ALL | E_STRICT);
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
ob_implicit_flush (1);
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
$_product = Mage::getModel('catalog/product')->load(15509);
$_images = $_product->getMediaGalleryImages();
foreach($_images as $_image)
{
    $mediaApi->update($_product->getId(),  $_image->getFile(),array('exclude' => 1));
}

Looking at the raw database I can see that the table catalog_product_entity_media_gallery_value has been successfully updated eg the column disabled is now set to 1 for the 10 images for the product. I can also see that the images have a tick in the excluded box in the product images detail page in the admin system.

HOWEVER....

When I go to the frontend its still showing me all the images for that product. When I debug on the frontend I can see that the the disabled flag is still set to 0 for the images. Example below

object(Varien_Object)#1036 (7) {
["_data":protected]=>array(11) {
["value_id"]=>
string(5) "15083"
["file"]=>
string(43) "/F/F/FF6D86FE39366DF362D711765C56FDAA_1.jpg"
["label"]=>
string(0) ""
["position"]=>
string(1) "1"
["disabled"]=>
string(1) "0"
["label_default"]=>.........

I have tried clearing all caches and re indexing however still I get the same issue.

The strange thing which leads me to believe it isnt cache if I run the following raw SQL

UPDATE `catalog_product_entity_media_gallery_value` SET `disabled` = '1' WHERE `disabled` = '0';

The images on the frontend dont display so its as though I am disabling the wrong images in my script but I dont see how

Can anyone help?

*****UPDATE*****
If I view the actual MySQL table catalog_product_entity_media_gallery_value and look up value_id 15083 I can see there are 2 records.

value_id    store_id    label   position    disabled
15083           0        \N       0           1
15083           1        \N       1           0

So my script only updates the record with with store id of 0

So this leads me to 2 questions

How do I update the image so it does it across all stores
Why is there 2 rows as the Magento instance only has 1 store


texts: How to add link to homepage in top menu? (Magento 2)

texts:
How do you add a link to the homepage in the top menu? It must be the first link, after this link must be the links to the categories.

Thanks in advance.

Extra information: my theme is based on the build-in Luma theme, I'm using Magento 2.1.


texts: How to Add a Image Upload Field to Custom Options in Magento 2?

texts: I need to create new image upload field in product customizable option section.


texts: Use Categories Path for Product URLs not working

texts:
I have set "Use Categories Path for Product URLs" to "No", but still on frontend I am seeing product urls with category paths.
Checked attribute value on store level also, and it is set to "No" as required.
I have performed re-indexation and cleared cahe (both Magento and browsers).
I am using Magento 1.4.2.0

UPDATE
When I am looking at product collection, it is not having any attirube named "request_path" instead it is showing "url_path".

Please let me know if it was a default magento bug in this version or I am missing something.
Any help will be appreciated.


texts: How to get similar kind of sku in catalog search result?

texts:
I have to create new feature such as did you mean, which is shown in google search engine.

I have multiple similar product sku like G HT2, G HT3 and G HT4. And When I am going to search product with G HT1 (sku). It will show me result as "no such a result found for 'G HT1' ". Its true. Because there are no sku like G HT1

But I need there like "did you mean G HT2, G HT3, G HT4", when I am going search with G HT1.

I hope you will get my point, what I want to do.
If any good suggestion, please let me know. It will be great help for me.

Thank you


texts:
I'm creating Product create / Edit API for admin.

In product edit API some attributes are in custom_attribute section(most of newly create) some are in extension_attribute and remain are directly within attribute code i
'm passing in the payload.

My question when creating Product how can I separate which attributes are within which section.directly,custom_attribute section or within extension_attribute section.because an at a time of product creation I can not separate attributes in section by using attribute set.


texts: How to fix product image upload in Magento 1.4.1.1?

texts:
I am facing issue while uploading the product images in Magento ver. 1.4.1.1 from admin. When I try to upload the image I do not get any error but the images are not visible in the front end as well as in the admin section of Magento.

I am able to see the message like following screenshot.

I have following folder created

/media/tmp/catalog/product

Under this folder the images are visible.

The issue is happening on windows 7, xampp server.
On my Linux environment it is working fine.

Please help me to fix the issue.


texts: Magento 2 : Get Quote Item Selected Options

texts:
I want to programmatically fetch quote item options which are currently selected.

I've added product with options like following;

Color : Red
Size  : 6

Now I want to fetch that selected options programmatically in another Controller.

How can I do that.


texts: How to call custom slider from backend to frontend dynamically in magento2.2.5?

texts:
I have created a custom module in backend for uploading image slider in homepage, but I am not able to call in homepage?(frontend).
I don't know where I am making mistake.

Here is my code.

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$modelCollection = $objectManager->get('Amy\Homebanner\Model\Grid')->getCollection();
 echo "
";
 var_dump($modelCollection->getData());
  echo "
";
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

?>

     <?php foreach ($modelCollection as $_model) { ?>
        <?php if ($_model->getIsActive() == '0' && $_model->getPageSelection() == '1') { ?>
                <li <?php if ($_model->getUrl() != '') { ?> onclick="location.href = '<?php echo $_model->getUrl() ?>'" <?php } ?>>

        <?php if ($deviceDetect->isMobile()) { ?>

                <img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $_model->getImageMobile() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />

        <?php }else{ ?>

                <img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $_model->getImage() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />
        <?php } ?>

        <?php } ?>
        <?php } ?>

When the status is enabled the homepage shows blank, while the status is disabled the homepage is showing but the slider is not showing.

Any help would be appreciated.


texts:
I have a frontend form which consists of two fields. One is a PDF file uploader field. The second one is a ZIP file uploader field.
Now how do I save these two fields in the database? In which directory do I need to save the PDF files and ZIP files?


texts: Get Current Visitor Id form Vistior Collection Magento2

texts: How i can get Current Visitor id Form visitor collection?


texts:
I am not able to add product to cart.

tried these solutions but not working.
https://stackoverflow.com/questions/41463643/magento-2-products-not-being-added-to-cart

add to cart not working localhost Only in chrome (Magento 2 fresh install )

can anyone please help me.
Thanks in advance.


texts: How to add websites dropdown in admin form and grid?

texts:
I have created a custom module for this.
but its showing Id in database and grid also, in form only its showing label.

how i can get website label instead of website id in grid. please help.
This is my prepare form code:

$fieldset->addField(
                'website',
                'select',
                [
                    'name' => 'website',
                    'label' => __('Associate to Website'),
                    'title' => __('Associate to Website'),
                    'required' => true,
                    'values' => $this->_systemStore->getWebsiteValuesForForm(),

            ]
        );

This is a my grid column code:

<column name="website">
           <argument name="data" xsi:type="array">
               <item name="config" xsi:type="array">
                   <item name="filter" xsi:type="string">text</item>
                   <item name="label" xsi:type="string" translate="true">Website</item>
               </item>
           </argument>
       </column>


texts: Magento : Catalog URL Rewrites Index Process is Working Now

texts: I am running magento 1.9 CE. when I am trying to index it shows this error -         Catalog URL Rewrites Index process is working now. Please try run this process later.


texts: how to get which filter is applied first in layered navigation

texts:
I need the order on which the filter is applied.for example if we select red value in color attribute and then we select  L value in size attribute means I need that order ie)color and then Size not size and color .I want order on which filter is applied
Scenario:image :image link
In this image i have first selected blue color next i have selected category jackets .I need the value of color because it is first selected but after selecting category, category  goes first


texts:
Payment gateway with third party redirects in magento2 not working

public function placeRequest(TransferInterface $transferObject)
    {
        $response = $this->generateResponseForCode(
            $this->getResultCode(
                $transferObject
            )
        );
        //header("location:https://www.google.com/");

        // $CustomRedirectionUrl = $this->_url->getUrl('https://www.google.com/');
        // $this->_responseFactory->create()->setRedirect($CustomRedirectionUrl)->sendResponse();

        $this->logger->debug(
            [
                'request' => $transferObject->getBody(),
                'response' => $response
            ]
        );

        return $response;
    }


texts: Configurable Products - update price by selected simple product

texts:
I#m building up an store based on Magento CE1.9.1 with configurable products. In the past there were Extensions like Simple Configurable Product and Better Configurable Product, but SCP isn't up to date and BCP doesn't work with HTML5-Themes.

Do anyone of you know how it is possible (or is there another extension) to update the product price depending on the selected simple product price?

Is it possible to select the default simple product on configurable product?


texts: When add second product, custom attributes not save data. Using event " sales_quote_item_set_product " in Magento 2

texts:
I used the sales_quote_item_set_product event to save data to the table when adding to cart product. It works but when I add the next product, it does not save the old data in the old field.

My observer

$quoteItem = $observer->getQuoteItem();
$product = $observer->getProduct();
$quoteItem->setAllowedAge($product->getData('age_status'));

Add first product, my data like this

Add second product, my data like this


texts:
I am facing strange problem, when I use direct SQL query method in Magento controller its not working

    $resource     = Mage::getSingleton('core/resource');
    $connection   = $resource->getConnection('core_write');
    $table        = $resource->getTableName('toynav_referral');

    $query        = "INSERT INTO {$table} (`referral_id`,`email`,`coupon`) VALUES ('1', '2', '3')";
    $connection->query($query);

But when I use this in controller its working fine and one thing the fetch method works everywhere as expected.
When I debug in the system.log file i got the below error

  User Error: Some transactions have not been committed or rolled back  in /var/www/vhosts/************/httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 3937

Please advise me


texts: How to Include a Third-Party Javascript in Magento 2 Using requirejs

texts:
I tried to include a Jquery lightbox script (Ekko Lightbox) in one of my Magento 2 CMS pages. But when I click on the trigger links to display a video, nothing seems to happen in the browser, but looking at the console, I see the following error: "No template was found by selector: null".

As far as I can tell, the appropriate JQuery and lightbox scripting is being loaded correctly so I think the problem is with how I'm calling the script in the CMS page:

...and then, in the content of the page, the script is called with this kind of markup:

View

UPDATE:
It was suggested that the lightbox scripts need to be added to the requirejs-config file, which I did. But I'm not sure that it's added correctly. Here's the contents of the requirejs-config file:

var config = {
    paths: {
            'bootstrap':'Magento_Theme/js/bootstrap.bundle',
            'ekkolightbox':'Magento_Theme/js/ekko-lightbox',
    } ,
     map: {
        '*': {
            'ekkolightbox': 'js/ekko-lightbox'
        }
    },
    shim: {
        'bootstrap': {
            'deps': ['jquery']
        },
        'ekkolightbox': {
            'deps': ['bootstrap']
        }
    }
};

I don't understand this error or what I might do to fix it. What is going on here and how can I troubleshoot?


texts: magento 1.9. Default checkout page don't working

texts:
i use for payment braintree, but when i was on the page where you need to make a payment, nothing displays for me where to enter card data.
How display default checkout page?


texts: Newsletter disabled, but still appears on website during checkout

texts:
I disabled the mage_newsletter in Magento, but newsletter subscription still appears in checkout when a customer buys an item.

I have tried flushing the cache, but this makes no difference. Any ideas?


texts:
I feel like i've read and tried every solution i possibly could and nothing works.

I removed from product page by overiding .phtml files in custom theme, easy.

I then successfully removed from the product grid but then after around an hour or two i noticed it was back and since i haven't been able to get rid of it.

I put the files back to how they were and then did the exact same steps again and nothing.

Im really at a los and cant understand why theres not just a button in the settings to disable this. I know there is something you can set in php somewhere to disable it but i have no idea where or how to do that.

I also understand this can be done in xml but again i have no idea how or what xml file to change. i installed a module and a chrome extension to get the xml block names but i cant get any of my attempts to change any thing.

Any help would be greatly appreciated.


texts: Create quantity invetory with multiple stock_ids in magento1.9

texts:
I have two stock_ids (1,3) in cataloginventory_stock_item table for product admin inventory quantity fields,
While iam creating the product using apis, i wants to create product by multiple stockids for different quantity value fields, in magento1.9

for single stock iam creating by below code:

$stockItemData = array('manage_stock ' => 1,
    'use_config_manage_stock' => 1,
    'stock_id' =>  1,
    'qty' => 5,
    'is_in_stock ' => 1

);

In the above code need to pass multiple stockid for creating product through soap api.

Thanks


texts: I am facing this issue when placing order in magento 2.4.0. I am using multi store website. How to i can fix this issue ?


texts: Automate cross-sell, up-sell and related products

texts: I have a designed theme that i like and i have to manually set cross sells and up-sell and related products. If i install an extension from third party, the design will not be the same. I would like to use the theme design, the same way products are displayed when I set them manually, but just automate the process. How do I do that without the need to install third party extension and redesigning its theme?


texts: Magento2: unable to get Actual result by using getSize()?

texts:
Collection

protected function _getProductCollection()
{
        $tagModel = $this->tagTagFactory->create();
        $this->_productCollection = $this->_productCollection
            ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
            ->addTagFilter($this->getTag()->getId())
            ->addStoreFilter($this->_storeManager->getStore()->getId())
           // ->addMinimalPrice()
            ->addUrlRewrite()
            ->setActiveFilter();

      $this->_productCollection->addAttributeToFilter('status', ['in' =>
      $this->_productStatus->getVisibleStatusIds()]);
      $this->_productCollection->setVisibility($this->_productVisibility->getVisibleInSiteIds());
      return $this->_productCollection;
}

I am trying to get $this->_productCollection->getSize() which doesnot reflect proper result.


texts:
I need override \vendor\magento\module-catalog-search\Model\Layer\Search\Plugin\CollectionFilter.php File,
i need get the search term and replace "-" and "." for nothing. Which a best method for make this?
I know how to override view files in my design theme but i don't know how to override Model files.
Example:
<?php
/**
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\CatalogSearch\Model\Layer\Search\Plugin;

use Magento\Catalog\Model\Category;
use Magento\Search\Model\QueryFactory;

/**
 * Catalog search plugin for search collection filter in layered navigation.
 */
class CollectionFilter
{
    /**
     * @var \Magento\Search\Model\QueryFactory
     */
    protected $queryFactory;

    /**
     * @param QueryFactory $queryFactory
     */
    public function __construct(QueryFactory $queryFactory)
    {
        $this->queryFactory = $queryFactory;
    }

    /**
     * Add search filter criteria to search collection
     *
     * @param \Magento\Catalog\Model\Layer\Search\CollectionFilter $subject
     * @param null $result
     * @param \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $collection
     * @param Category $category
     * @return void
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterFilter(
        \Magento\Catalog\Model\Layer\Search\CollectionFilter $subject,
        $result,
        $collection,
        Category $category
    ) {
        /** @var \Magento\Search\Model\Query $query */
        $query = $this->queryFactory->get();
        if (!$query->isQueryTextShort()) {
            $text = $query->getQueryText();
            $text = str_replace(array("-","."),"",$text);
            $collection->addSearchFilter($text);
        }
    }
}


texts:
Can anyone shade some light on the real usage of is_active field in sales_flat_quote table?

AFAIK, is_active field is used in the following cases:

is_active is always 1 for cart/quote created by web user
is_active is always 0 for cart/quote created from admin
To load quote by Customer Id, is_active = 1 is taken into account
When quote is converted to order, is_active becomes 0
To restore the quote which is cleared by payment errors etc during checkout., make is_active = 1
When you create a quote via API, is_active is always 0 (not sure why?)

My Questions:

I would like to know if the above bullet points are correct?
Why is_active is always 0 for quote created via API?
How to get quote items by customer id / email via API?


texts: How can I increase the amount of time a customer gets to shop in a store? My login/ cart clears after 10 minutes.


texts: How to change customer password quickly in Magento 2

texts:
In Magento 1 from admin configuration under Manage Customer section we can update/change the customer new password easily.

In Magento 2 Sending password reset with only email will help, but not always. This may be a simple question, but sometimes it will save lot of time.

Is there any easy way to change the customer password in Magento 2 ?
Is there any way from database where we can directly change the password with encryption type?

Help would be appreciated.


texts: Pass a form field value to server in checkout page

texts:
I am using the onestepcheckout extension as the store checkout.

One payment method allows customers to pay in payments.

The form collect the payments value using the following select field:

<select id="paymentsno" name="payment[additional_information][payments]" style="width: 263px;" class="selectboxit-hide-it">
   <option value="1">1</option>
   <option value="2">2</option>
</select>

I am expecting to get this value in the payment method model:

$payment = $order->getPayment();
$paymentAdditional = $payment->getAdditionalInformation();
$payments = $paymentAdditional->getPayments();

I am able to retrieve a value but it is always the default value of the select e.g. 1

Any idea why?


texts:
I am trying to add a functionality in magento2 using Angular. But every time I run the page it gives this error

Uncaught Error: [$injector:modulerr] Failed to instantiate module MbApp due to: Error: [$injector:nomod] Module 'MbApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

then after Hard Reload and Clear Cache it works.

These are my scripts

<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/angularjs/angular.js"></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/angular-sanitize/angular-sanitize.js"></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/ng-file-upload/angular-file-upload.js" ></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/fancybox/source/jquery.fancybox.js" ></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/bower_components/fabric/dist/fabric.js" ></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/mb-app.js" ></script>
<script type="text/javascript" src="http://127.0.0.1/magento/pub/static/frontend/Magento/luma/en_US/Moodboard_Canvas/js/moodboard_canvas/canvas.js" ></script>

I tried with angular cdn but that didn't work. So why it's not working at first time but after multiple reloads.


texts:
how it's possible to show alert message (alert from javascript) in magento observer? I successfully registered an observer on event _customer_save_before_. Now I want only to show an alert in observer (for example "Hello user!").

Observer.php

<?php
class MyModule_Observer extends Mage_Core_Model_Abstract
{
  public function customerSaveBefore(Varien_Event_Observer $observer)
  {
     // TODO Need to show an alert here
  }
}

config.xml

<frontend>
    <events>
        <customer_save_before>
            <observers>
                <MyModule>
                    <type>singleton</type>
                    <class>MyModule_Observer</class>
                    <method>customerSaveBefore</method>
                </MyModule>
            </observers>
        </customer_save_before>
    </events>
</frontend>

How to show an alert on the frontend in the simpliest way?
Thank you!


texts: How to show the total quantity number(Like 10) instead of In Stock Status in Magento 2.x?

texts:
I need help for Magento 2.x. Recently I have developed a eCommerce site. On products details page has "Stock Availability" using "In Stock" status.

So, I want to show the total number of quantity "like Stock: 20" instead of "In Stock" Status.

Could anyone please help to do that in my Magento 2.x eCommerce website.

Please check my attached images below then you can get the clear idea about my words what i have mentioned in above?

Please tell me where I have to write the code to get total quantity number Like "Stock: 20"

Thanks in Advance

Ben


texts:
I have a problem with one particular site that throws this error periodically

Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in app/code/core/Mage/Catalog/Model/Product.php on line 39

I clear cache : Didn't work
I restart apache : Site comes back.

EDIT: I am getting the same error in Admin in the products section as well.

I am not running memecache or REDIS or APC

PHP Version 5.3.29

Apache/2.2.29 (Amazon)

http://candle.m.agen.to/phpinfo.php


texts:
I need to make my minicart not include in Magento's FPC.
So, I've added below code to my layout's default.xml file.

<block class="Magento\Framework\View\Element\Template" name="custom.header" template="Magento_Theme::html/header.phtml" cacheable="false">
                    <arguments>
                        <argument name="target" xsi:type="string">contentarea</argument>
                        <argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
                    </arguments>
                </block>

But, The problem is now header is included in all pages of website, And its make website slower, Like we have disabled cache from admin.

I've seen many questions regarding not to use cacheable="false".

Is there is any solution to make it possible ??

Thanks in Advance.


texts: Magento 2 : after upgrading magento 2 with command site not working

texts:
After upgrading the Magento 2, the following error is showing in browser:

  exception 'RuntimeException' with message 'Can't create directory /home/saudifishcorner/public_html/var/generation/Magento/Framework/App/Response/Http/.'
  in
  /home/saudifishcorner/public_html/vendor/magento/framework/Code/Generator.php:115
  Stack trace: 0
  /home/saudifishcorner/public_html/vendor/magento/framework/Code/Generator/Autoloader.php(35):
  Magento\Framework\Code\Generator->generateClass('Magento\Framewo...')
  1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Framewo...')
  2 [internal function]: spl_autoload_call('Magento\Framewo...') 3 /home/saudifishcorner/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(19):
  ReflectionClass->__construct('Magento\Framewo...') 4
  /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44):
  Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...')
  5 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71):
  Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...')
  6 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(71):
  Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...')
  7 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(126):
  Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...')
  8 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53):
  Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array,
  'Magento\Framewo...', NULL, 'response', 'Magento\Framewo...') 9
  /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82):
  Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...',
  Array, Array) 10
  /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(57):
  Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...',
  Array) 11
  /home/saudifishcorner/public_html/vendor/magento/framework/App/Bootstrap.php(233):
  Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...',
  Array) 12 /home/saudifishcorner/public_html/index.php(38):
  Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...')
  13 {main}


texts: Adding (already created) Attributes to Simple Product

texts:
Is it possible to add already created attributes to already created simple products? And then is it possible to add those simple products to an already created configurable product? Or is it a one-way street with configurable products & their attributes?

My client has a category of 175 products that they would like to compile into one big configurable product. The products essentially all have the same content & names...just different sizes, materials, sku's, etc. (this is how the category was laid out on the previous system before the database was imported into Magento) I'd prefer not to have to recreate all these simple products via the configurable product, but I haven't seen much discussion about this so I thought I'd ask.

They're currently set up with CE 1.7.0.2


texts: I am little bit confuse. I am using magento orm basic like Mage::getModel('test/test') and I search that also use direct SQL query use for insert,update and delete so my question is which one is better and if I use direct SQL query so any arise security issue in future or secure direct SQL query in magento ? Which one is better both of them ? Please guide me


texts: Rewrite Model and Interface not working for newly added methods

texts:
I want to add country name in the address list of customers/me rest api.

I have tried adding my changes in core files and I got the desired result. But when I try to rewrite, it doesn't work.

Can anyone please check and help me with this?

etc/di.xml file:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <preference for="Magento\Customer\Model\Data\Address" type="Company\Module\Model\Data\Customer\Address"/>
</config>

Address.php file:

<?php

namespace Company\Module\Model\Data\Customer;

use \Magento\Framework\Api\AttributeValueFactory;

class Address extends \Magento\Customer\Model\Data\Address implements \Company\Module\Api\Data\Customer\AddressInterface
{

    /**
     * Locale model
     *
     * @var \Magento\Framework\Locale\ListsInterface
     */
    protected $_localeLists;

    /**
     * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
     * @param AttributeValueFactory $attributeValueFactory
     * @param array $data
     */
    public function __construct(
            \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
            AttributeValueFactory $attributeValueFactory,
            \Magento\Customer\Api\AddressMetadataInterface $metadataService,
            \Magento\Framework\Locale\ListsInterface $localeLists,
            $data = []
    )
    {
        $this->_localeLists = $localeLists;
        parent::__construct($extensionFactory, $attributeValueFactory, $metadataService, $data);
    }

    /**
     * Get Country name
     *
     * @return string|null
     */
    public function getCountryName()
    {
        $country_id = $this->getCountryId();
        $country_name = (string) $this->_localeLists->getCountryTranslation($country_id);
        return $country_name;
    }

}

AddressInterface file:

<?php

namespace Company\Module\Api\Data\Customer;

/**
 * Customer address interface.
 * @api
 */

interface AddressInterface extends \Magento\Customer\Api\Data\AddressInterface
{

    /**
     * Country Name from Country Id
     *
     * @return string|null
     */

    public function getCountryName();

}

when I use any existing function from parent model file and do changes in it, it works. So I think rewrite is working fine. But it doesn't work for the newly added function.


texts: Magento 2 : How to add Conditional Links in Layout?

texts:
I've added my custom link to top.links using layout.xml

  Vendor/Module/view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="top.links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="something-link">
            <arguments>
                <argument name="label" xsi:type="string">Create Something</argument>
                <argument name="path" xsi:type="string">Route/Controller/index</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

One More I've added at Customer Account Page

  Vendor/Module/view/frontend/layout/customer_account.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="customer_account_navigation">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="something-name">
            <arguments>
                <argument name="path" xsi:type="string">route/controller/index</argument>
                <argument name="label" xsi:type="string">My Something</argument>
                <argument name="sortOrder" xsi:type="number">2</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

  First Link which is at top.links I would like to only show if customer is logged in.

  Second will only display if customer is in Customer Group That is Wholesale.

How can i achieve this ???

Any Ideas ??


texts:
I've created a widget with a wysiwyg inside it (with the class from this module Dmatthew\WidgetParameters\Block\Adminhtml\Widget\Type\Wysiwyg)
BUT
When I'm adding my content, with the strong, underline or other html tag, it's working fine.
But if I change the color (it's adding a span) with style="color:blue", the quote from the style is cutting my content.
Is there a way to prevent it ?
    public function prepareElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
    $editor = $this->factoryElement->create('editor', ['data' => $element->getData()])
        ->setLabel('')
        ->setForm($element->getForm())
        ->setWysiwyg(true)
        ->setConfig(
            $this->wysiwygConfig->getConfig([
                'add_variables' => false,
                'add_widgets' => false,
                'add_images' => false
            ])
        );

    if ($element->getRequired()) {
        $editor->addClass('required-entry');
    }

    $element->setData(
        'after_element_html', $this->_getAfterElementHtml() . $editor->getElementHtml()
    );
    $element->setValue(''); // Hides the additional label that gets added.

    return $element;
}

EDIT : this is what I get after saving my widget. All the word after I've added a color (with the wysiwyg) to the text is cut (and show span in wysiwyg)

EDIT 2 : this is my widget definition :

    Video
    Vidéo et description

    <parameter name="url" xsi:type="text" required="true" visible="true">
        Identifiant Youtube de la vidéo
    </parameter>

    <parameter name="subtitle" xsi:type="text" required="true" visible="true">
        Sous titre
    </parameter>

    <parameter name="content" xsi:type="block" visible="true" required="true">
        Contenu associé à la vidéo
        <block class="Dmatthew\WidgetParameters\Block\Adminhtml\Widget\Type\Wysiwyg"/>
    </parameter>

</parameters>


texts:
I am using Magento ver. 1.9.1.1 in here Configurable swatch not available in backend. I follow this for configurable swatch http://www.venustheme.com/configurable-swatches-guide-for-magento-1-9-1/

I don't know what is the problem


texts: Getting "DDL statements are not allowed in transactions " error when re-index programmatically in magento 2.2.X

texts:
I am working on Magento 2.2.6. As per requirement I need to do re-index on sales_order_save_after  event.

It is working well in Magento 2.1.X but I am getting following error on Magento 2.2.X.

  Error: CRITICAL: User Error: DDL statements are not allowed in
  transactions in vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on
  line 504

Can anyone help me on the same ? I have to re-index after order complete as I need to display that order in my custom front-end page. Without re-index it is not displaying.


texts:
when i try to insert  new category  in database no error appear and no category inserted
here is my code what is wrong

  not that the new categories are parent not child

  $cat_arr  have some categories

try{
                $category = Mage::getModel('catalog/category');
                foreach ($cat_arr as $cat ) {

                        $category->setName($cat['shortName']);
                        $category->setUrlKey($cat['localizedId']);
                        $category->setIsActive(1);
                        $category->setDisplayMode('PRODUCTS');
                        $category->setIsAnchor(1); //for active achor
                        $category->setDescription($cat['name']);

                        $category->setStoreId(Mage::app()->getStore()->getId());
                        $category->setAttributeSetId($category->getDefaultAttributeSetId());
                        // $parentCategory = Mage::getModel('catalog/category')->load($parentId);
                        // $category->setPath($parentCategory->getPath());

                        $category->save();
                    }
                    } catch(Exception $e) {
                        var_dump($e);
                    }