texts:
I'm trying to hide prices and "add to shopping cart" for guests.
To do that I need to check whether the customer is logged in or not. There are no predefined methods in the Catalog Widget block so I need to extend the class via preference.
I've successfully extended the block Magento\Catalog\Block\Product\ListProduct but Magento\CatalogWidget\Block\Product\ProductsList is trickier.
When I try it, I get main.CRITICAL: Invalid template file: 'product/widget/content/grid.phtml' in module: 'Vendor_Namespace' block's name: 'product\productslist_0' in system.log.
Any solutions to this?
Edit
This is the contents of the 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\CatalogWidget\Block\Product\ProductsList" type="Vendor\Namespace\Block\Product\ProductsList" />
</config>

This is the contents of the ProductsList.php file:
<?php
namespace Vendor\Namespace\Block\Product;

class ProductsList extends \Magento\CatalogWidget\Block\Product\ProductsList
{
    protected $_httpContext;

    public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
        \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,
        \Magento\Framework\App\Http\Context $httpContext,
        \Magento\Rule\Model\Condition\Sql\Builder $sqlBuilder,
        \Magento\CatalogWidget\Model\Rule $rule,
        \Magento\Widget\Helper\Conditions $conditionsHelper,
        array $data = []
    ) {
        $this->_httpContext = $httpContext;
        parent::__construct(
            $context,
            $productCollectionFactory,
            $catalogProductVisibility,
            $httpContext,
            $sqlBuilder,
            $rule,
            $conditionsHelper,
            $data
        );
    }

    protected function _construct()
    {
        parent::_construct();
        // Tested, but does not work
        // $this->setTemplate('Vendor_Namespace::product/widget/content/grid.phtml');
    }

    public function isCustomerLoggedIn()
    {
        return $this->_httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
    }
}


texts: Error when calling addFieldToFilter() to query model with where condition

texts:
I've created a Model and a Resource Model. I tried to query for records from the database through the Mage::getModel() function like this:

$model = Mage::getModel('custommodule/mymodel')->getCollection();
$model = $model->addFieldToFilter("model_id", 1);

But I keep getting this error:

Fatal error: Call to a member function addFieldToFilter() on boolean in C:\wamp\www\samplestore\testing.php on line 19

model_id is my primary key. I've no problem retrieving data when I do it this way:

$model = Mage::getModel('custommodule/mymodel');
$model = $model->load(1);

This is how my resource model look:

class TestNS_CustomModule_Model_Resource_MyModel extends Mage_Core_Model_Mysql4_Abstract
{
    public function _construct()
    {
        $this->_init('custommodule/mymodel', 'model_id');
    }
}

And this is how my config.xml look:

<models>
    <custommodule>
        <class>TestNS_CustomModule_Model</class>
        <resourceModel>custommodule_resource</resourceModel>
    </custommodule>
    <custommodule_resource>
        <class>TestNS_CustomModule_Model_Resource</class>
        <entities>
            <mymodel>

testns_custommodule_moduletable

            </mymodel>
        </entities>
    </custommodule_resource>
</models>

I can get the data if I do a load(1), but not when I call . It seems like getCollection() is returning a false boolean, why is this so?

Why am I getting an error when calling addFieldToFilter()? If I can't do it this way, how can I add in a "where" clause to select a record from the model?


texts: How do I get product name for whatever product page I am on?

texts:
I have looked around and I swear all I can do is just get all product names to display.

For example if I am on product page x I want to show x's product name. So far I have the below code and it displays them all.

    <?php
     $_products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name');

     foreach ($_products as $product){
     $prod_name = $product->getData('name');
     echo $prod_name . '<br>';
     $attribute = $product->getData('attribute');

 }
    ?>


texts: Is there a way to set a "Maximum Order Total" for PayPal?

texts:
Is there a way to set a "Maximum Order Total" for PayPal, similarly to the one you can set on other payment methods (without editing core files)?

Edit: Here is the solution if anyone else is wondering how to do this.

I manned up and made a small module for this, following a tutorial and grabbing a few code snippets from different threads on here. This Module will hide the PayPal option if the cart total is above 5000 (Currency).

1. First create "app/etc/modules/PPlimit_Module.xml" with this content:

<?xml version="1.0"?>
<config>
    <modules>
        <PPlimit_Module>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Payment/>
            </depends>
        </PPlimit_Module>
    </modules>
</config>

2. Create "app/code/local/PPlimit/Module/etc/config.xml" containing:

<?xml version="1.0"?>
<config>
<modules>
    <PPlimit_Module>
        <version>0.0.1</version>
    </PPlimit_Module>
</modules>

<global>
    <models>
        <PPlimit_Module>
            <class>PPlimit_Module_Model</class>
        </PPlimit_Module>
    </models>
    <events>
        <payment_method_is_active>
            <observers>
                <pplimit_module>
                    <type>singleton</type>
                    <class>PPlimit_Module/Observer</class>
                    <method>paymentMethodIsActive</method>
                </pplimit_module>
            </observers>
        </payment_method_is_active>
    </events>
</global>

</config>

3. Create "app/code/local/PPlimit/Module/Model/Observer.php" with this code:

 <?php

class PPlimit_Module_Model_Observer
{
    public function paymentMethodIsActive($observer)
    {
        $instance = $observer->getMethodInstance();
        $result = $observer->getResult();

        if ($instance->getCode() == "paypal_express" || $instance->getCode() =="paypal_standard") {         //Payment Method

        $total = $observer->getQuote()->getGrandTotal();

            if ($total<=5000) {                                 //Payment Limit
                $result->isAvailable = true;
            } else {
                $result->isAvailable = false;
            }
        }
    }

  }

?>

That's it, tell me if you find a bug!


texts: Ajax Add to cart in wishlist page magento 2.4

texts:
I'm looking for a way to add ajax functionality to the wishlist page. So when I add a product to the cart in my wishlist page it utilizes ajax.
How would I approach this?
Hope for an answer. Thanks in advance.


texts: Magento 1.9 - How to add frontend html code to all site pages

texts:
I'm trying to add a div that will exist on all pages of the site, but I can't find out how to add html to the body. I've edited the template phtml file (which only contains one section of the body anyways, so don't think that's the correct way to edit), and changes to the phtml file does not take effect anyways.

How do I go about this? I'm trying to just add a single div to the site, containing a popup configured by an existing javascript file. Just not sure how to add code.

Edit: For example when I inspect a page I see line , but no files or column files contain that line.


texts: Magento failing when trying to save product inside event observer on frontend?

texts:
I have a function that is tied to an event observer

One of the requirements is that when it loops through the order item data, if a certain product attribute is empty it issues a request to get specific data through a separate model (working fine).

the problem code basically boils down to this

foreach ($order->getAllItems() as $key => $item) {
    /** @var Tantor_Catalog_Model_Product $productData */
    $productData = $item->getProduct();
    $_item = Mage::getModel('catalog/product')->load($productData->getId());
    $_item->setNetsuiteItemIid('foo');
    $_item->save();
}

however Magento is throwing an exception of

2014-03-05T21:14:14+00:00 ERR (3):
exception 'Exception' with message 'Warning: Invalid argument supplied for foreach()  in /var/www/html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1180' in /var/www/html/app/code/core/Mage/Core/functions.php:245
Stack trace:
#0 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1180): mageCoreErrorHandler(2, 'Invalid argumen...', '/var/www/html/a...', 1180, Array)
#1 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1123): Mage_Eav_Model_Entity_Abstract->_collectSaveData(Object(Tantor_Catalog_Model_Product))
#2 /var/www/html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Eav_Model_Entity_Abstract->save(Object(Tantor_Catalog_Model_Product))
#3 /var/www/html/app/code/local/Tantor/Netsuite/Model/Observer.php(218): Mage_Core_Model_Abstract->save()
#4 /var/www/html/app/code/core/Mage/Core/Model/App.php(1338): Tantor_Netsuite_Model_Observer->saveOrder(Object(Varien_Event_Observer))
#5 /var/www/html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Tantor_Netsuite_Model_Observer), 'saveOrder', Object(Varien_Event_Observer))
#6 /var/www/html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('sales_order_pla...', Array)
#7 /var/www/html/app/code/core/Mage/Sales/Model/Order.php(1096): Mage::dispatchEvent('sales_order_pla...', Array)
#8 [internal function]: Mage_Sales_Model_Order->place()
#9 /var/www/html/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): call_user_func(Array)
#10 /var/www/html/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks()
#11 /var/www/html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
#12 /var/www/html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
#13 /var/www/html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(774): Mage_Sales_Model_Service_Quote->submitAll()
#14 /var/www/html/app/code/core/Mage/Checkout/controllers/OnepageController.php(511): Mage_Checkout_Model_Type_Onepage->saveOrder()
#15 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->saveOrderAction()
#16 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#17 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#18 /var/www/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#19 /var/www/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#20 /var/www/html/index.php(86): Mage::run('', 'store')
#21 {main}

Why would i be able to use identical code in a 3rd party script outside the magento observer just fine, but when I try to run it inside that observer, it fails with that random error message?


texts: Adding a custom attribute in product detail page in magento

texts:
I want to add a custom "text_area" attribute after the short description in products page

attribute_id : 1109, attribute_code : rerestock

so I put the code in view.phtml

<div class="rerestock">
     <?php echo $_product->getrerestock(); ?>
</div>

but I also want to put

 <?php echo 'RESTOCK INFORMATION ?>

only 'rerestock' attribute is filled with some information.


texts:
here is my code.. when i am using getData() , it will give whole array..

 $model = Mage::getModel('warranty/warranty');

                    $war = $model->getCollection()
                                    ->addFieldToSelect('*')
                                    ->addFieldToFilter('product_id',  array('eq' => $productId))
                                    ->load();

echo'<pre>';print_r($war->getData()); die;

output:

Array
(
    [0] => Array
        (
            [id] => 9
            [product_id] => 554
            [warranty_period] => 2 month
            [price_in_warranty] => 500
            [price_out_warranty] => 24
        )

)

but when i try to get id using

echo $war->getId(); die;

nothing will display. how to get id through above array?


texts: Lazy load Js not working in Magento2.3.1 Version

texts:
We use Magento2.3.1, in product list page showing error like

  Uncaught TypeError: $(...).lazyload is not a function.

While using Porto theme of Magento 2.x.


texts: Magento 2 Cross site scripting vulnerability PCI scan

texts:
PCI scan in our servers recently failed due to cross-site scripting vulnerability in Magento 2 pages. They have requested like below to reproduce the issue.

REQUEST:
GET /2018-2019-random-url.html?<script>alert('TK00000031')</script> HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: example.com
Content-Type: text/html
Content-Length: 0

Evidence: <script>alert('TK00000031')</script>

But we couldn't reproduce it in any browsers. Only in IE it detects it's cross-site scripting and stops the execution of the page.

Does anyone faced the same issue and got the resolution?


texts: Subscribe to newsletter with a check box selected in a custom form

texts:
I have created a custom form page where customers can submit details like name, email, etc and all the details are stored in a custom database table. The form includes following input fields.

Name Field:

<input id="name" name="name" value="<?php echo $_SESSION['name']; ?>" type="text" />

Email Field:

<input type="text" id="email" value="<?php echo $_SESSION['email']; ?>" name="email" />

In in the same form I have created another checkbox with subscription to newsletter option with the following code:

<?php
                        $email = $_POST['email'];
                        $status = Mage::getModel('newsletter/subscriber')->subscribe($email);
                        if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
                            Mage::getSingleton('core/session')
                               ->addSuccess($this->__('Confirmation request has been sent.'));
                        }
                        else {
                            Mage::getSingleton('core/session')
                                ->addSuccess($this->__('Thank you for your subscription.'));
                        }
                    ?>

In the Thank You page I do see the  Thank you for your subscription. message and the subscription does happens in Magento but for some reason the email that the customers entered in the email field is not being posted to the newsletter so how do I fix it.

Update:

I was able to post the email to Magento Newsletter email field by moving the

    if (isset($_POST['is_subscribed'])) {
        $subscribeemail = $_POST['email'];
        $status = Mage::getModel('newsletter/subscriber')->subscribe($subscribeemail);
            if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
                Mage::getSingleton('core/session')
                 ->addSuccess($this->__('Confirmation request has been sent.'));
            }
            else {
                Mage::getSingleton('core/session')
                ->addSuccess($this->__('Thank you for your subscription.'));
            }
    }

inside QuoteController.php file of the module. Customer First Name is still empty so how do I post Name field as Customer First Name?


texts: M2 Fatal error on saving customer account

texts:
Using Magento 2.3.1 we're getting the following error when trying to save any update to a customers account from the back-end...

Fatal error: Uncaught Error: Call to a member function getProduct() on boolean in /vendor/magento/module-configurable-product/Plugin/SalesRule/Model/Rule/Condition/Product.php:61 Stack trace: #0 /vendor/magento/module-configurable-product/Plugin/SalesRule/Model/Rule/Condition/Product.php(30): Magento\ConfigurableProduct\Plugin\SalesRule\Model\Rule\Condition\Product->getProductToValidate(Object(Magento\SalesRule\Model\Rule\Condition\Product\Interceptor), Object(Magento\Quote\Model\Quote\Item\Interceptor)) #1 /var/www/html/mag2/vendor/magento/framework/Interception/Interceptor.php(121): Magento\ConfigurableProduct\Plugin\SalesRule\Model\Rule\Condition\Product->beforeValidate(Object(Magento\SalesRule\Model\Rule\Condition\Product\Interceptor), Object(Magento\Quote\Model\Quote\Item\Interceptor)) #2 /var/www/html/mag2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\SalesRule\Model\Rule\Condition\Product\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Q in /vendor/magento/module-configurable-product/Plugin/SalesRule/Model/Rule/Condition/Product.php on line 61

Can anyone please help with a way to diagnose this issue?


texts: Profile State showing non initialized status in Magento Admin on the Sales Recurring (Profile) interface

texts:
The user made payment with credit card and the payment processed through PayPal payment gateway is showing 'Non-initialized' status in Magento Admin on the Sales Recurring (Profile) interface. Also the payment reference Id is not returned by PayPal in this case.

Can anyone tell what is the reason behind this?


texts: how Magento can be made more secure for the client?


texts:
I'm trying to build a CRUD module that uses UI components for admin grid and form.
I've did this before and worked, but this one is a bit different and apparently I screwed something up.
The problem is in the UI component file or some class referenced by the UI component file for sure. If I remove the UI component reference from the layout file, the page loads (without the grid obviously).
When including the UI component the page is blank and there is no error logged anywhere, even when on developer mode.

How/where can I start debugging the loading and rendering of the UI components?


texts: Magento 2 deploy static files for specific theme only

texts: How to deploy static view files for single, specific theme only?


texts: Invalid argument supplied for foreach in Mage/Eav/Model/Entity/Collection/Abstract.php on line 776

texts:
After upgrading magento to 1.8.1.0 (from 1.7.) I am now seeing this error in my system.log:

  2014-05-26T10:39:56+00:00 ERR (3): Warning: Invalid argument supplied for foreach()  in app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php on line 776

Line 776 of Abstract.php:

foreach ($fields as $alias=>$field) {
    if (isset($this->_joinFields[$alias])) {
        throw Mage::exception(
            'Mage_Eav',
            Mage::helper('eav')->__('A joint field with this alias (%s) is already declared', $alias)
        );
    }
    $this->_joinFields[$alias] = array(
        'table' => $tableAlias,
        'field' => $field,
    );
}

Anybody else seeing this error and is it a bad one or can it be ignored?


texts: Render pure HTML in magento admin form using UI form

texts:
I created one extenssion want to render some Pure HTML from the other blockand phtml file.

I have review some magento core code to render like this but not able to find the things.

In the review form magento still using generic class to render like this.

$fieldset->addField('customer', 'note', ['label' => __('Author'), 'text' => $customerText]);

    $fieldset->addField(
        'summary-rating',
        'note',
        [
            'label' => __('Summary Rating'),
            'text' => $this->getLayout()->createBlock(
                \Magento\Review\Block\Adminhtml\Rating\Summary::class
            )->toHtml()
        ]
    );

why magento still using generic class like this is there no way to do like this using UI form?


texts:
Use curl in custom module Magento ver 1.9.x

In /var/www/html/magento193/app/design/frontend/base/default/template/reviewrating/rightsidebar.phtml

$url = "http://mywebsite.com/api/extentionReviews?key=s4o3mbe8key9";
$getJson = $this->getDataFromApi( $url );
$ApiData = Mage::helper('core')->jsonDecode( $getJson );

print_r( $getJson );

In /var/www/html/magento193/app/code/local/Custommodule/ReviewRating/Block/Rightsidebar.php

public function getDataFromApi( $url )
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $data = curl_exec($ch);
    $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return ($httpcode>=200 && $httpcode<300) ? $data : false;
}

In /var/www/html/magento193/app/design/frontend/base/default/layout/reviewrating.xml

<reference name="right">
    <block type="reviewrating/rightsidebar" name="reviewrating_rightsidebar" beofre="-"  template="reviewrating/rightsidebar.phtml" />
</reference>

Output : I am still getting data in json format. i want it to be in array.

{   "success":true,
    "error":false,
    "error_code":"",
    "message":"Successfully listed."
    ..........
}


texts: How Magento process block defined inside layout xml?

texts:
I have strange situation where block defined in xml is not loaded. Everything is properly defined and it works on more than 500 stores. It is simple layout file like this:

layout.xml

  <?xml version="1.0"?>
  <layout version="1.0.0">
    <test_index_index>
      <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
      </reference>
      <reference name="content">
        <block type="company_test/example" name="test_index" template="test/index.phtml"/>
      </reference>
    </test_index_index>
  </layout>

config.xml

  <?xml version="1.0"?>
  <config>
    <modules>
        <Company_Test>
            <version>1.5.0</version>
        </Company_Test>
    </modules>
    <global>
          <helpers>
              <company_test>
                  <class>Company_Test_Helper</class>
              </company_test>
          </helpers>
          <blocks>
              <company_test>
                  <class>Company_Test_Block</class>
              </company_test>
          </blocks>
    </global>
  </config>

Which normally work, but in one particular store it won't work after upgrading the extension. But if I rename folder Company to Companyy and rename company also inside files it will work:

<block type="companyy_test/example" name="test_index" template="test/index.phtml"/>

The same happens also if I put test_index block into any other extension layout file inside this store, it won't work when first folder name is Company. My guess it that old file is still in server cache (not Magento cache). It won't log any error.

Now to my question. Which file gets block path from layout file and try to handle/process it? Before I start debugging and researching core files it would be useful if I can get any hint where to start.

tnx!


texts: Magento 2.3 - event when catalog price rules are applied

texts:
I am working in a module which extends catalogrule feature

In this module, we apply some changes to price calculation process. Right now, it is working when a product is saved in admin. We have achieved that by rewriting some classes in Magento/CatalogRule/Model/Indexer folder Magento2 catalogrule promotions, ability to choose price or special_price?

The pending thing is: module code are not being executed when applying rules in admin. I was thinking to observe catalogrule_apply_all event, but I am not sure if it still exists in Magento 2.3

The only reference for that event I have found is in vendor/magento/module-catalog-rule/Model/Rule/Job.php class

/**
 * Dispatch event "catalogrule_apply_all" and set success or error message depends on result
 *
 * @return \Magento\CatalogRule\Model\Rule\Job
 * @api
 */
public function applyAll()
{
    try {
        $this->ruleProcessor->markIndexerAsInvalid();
        $this->setSuccess(__('Updated rules applied.'));
    } catch (\Magento\Framework\Exception\LocalizedException $e) {
        $this->setError($e->getMessage());
    }
    return $this;
}

But that markIndexerAsInvalid() function doesn't seem to fire any event. It just seem to invalidate related index

Any tips? Which code is fired when applying catalog rules in admin?


texts: Magento 2 : Need to perform clean cache programmatically after records save

texts:
In admin side, I want to clean "eav" cache type on records save. I added code in afterSave() function and function also call after save records. But, I think it's not working because, parent afterSave() action perform after my function execute.

My code :

  app/code/VendorName/ModuleName/Model/ResourceModel/MyFile.php

/**
 * Action perform after save/duplicate records
 *
 * @param \Magento\Framework\DataObject $customer
 * @return $this
 * @throws \Magento\Framework\Exception\LocalizedException
 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
 * @SuppressWarnings(PHPMD.NPathComplexity)
 */
protected function _afterSave(\Magento\Framework\DataObject $object) {
    $this->cacheManager->clean(['eav']);
    return parent::_afterSave($object);
}

Note : After save records if I execute php bin/magento c:c eav Then, I received perfect output.

How can I solve this point?

Anyhelp would be appriciated.

Thanks.


texts: Different Manufactures related to Products/Categories

texts:
I have different manufactures for different products. The manufactures list can be very long if not filter by categories or products.

I am trying to know if there is a better way other than creating manufactures for each attribute set.

What is the best way to handle a lot of manufactures? How do people do when have very long manufactures list and different products?


texts:
I want to set a products stock status to "out of stock". This is the csv file content:

sku;is_in_stock
2714575;0

After that, the stock status did not change in the backend. Any idea what I am missing?

Thanks!


texts: Magento is adding strange value at the end of media files

texts:
I have moved Magento 1.9.1.0 from one domain to another. Everything works fine except media files, magento is adding strange numbers at the end of file end before file extension, for example:

  media/catalog/product/cache/1/small_image/780x7809df78eab33525d08d6e5fb8d27136e95/h/u/hu_25.jpg

Is loaded as:

  media/catalog/product/cache/1/small_image/780x7809df78eab33525d08d6e5fb8d27136e95/h/u/hu_25.1453999868.jpg

When i remove those numbers and additional dot, file is being loaded normally.
I was searching for solution for more then a week now. I would be very glad if anyone can tell me where did those number come from.

Also i want to mention that previously this website was using Redis for storing user cache and session. I switched it back to normal Magento cache and session storage.


texts: Change " Magento Commerce " from my links

texts:
I have a magento website Mypet.com.pk .When I search in google for mypet.com.pk it shows the title "Magento Commerce" written with all my links e.g.
Home page - Magento Commerce. Can anyone help me to change it to my domain name? Thanks in advance.


texts: How to translate strings with link in email template (Magento2)

texts:
I'm trying to translate

{{trans 'If you have questions about your order, you can email us at %store_email' store_email=$store_email |raw}}.

with this line in the .csv

"If you have questions about your order, you can email us at %store_email","Für Rückfragen stehen wir Ihnen jederzeit gerne zur Verfügung. Sie erreichen uns per E-Mail unter %store_email"

But it doesn't work. I have no problem with this one

{{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}


texts: How to set shipping address same as billing address on change shipping address from options magento 2?

texts:
i want to set billing address dynamically as per the change of shipping address
magento 2.
In checkout page "same as shipping" checkbox is there & its also checked still
changing the shipping address from the existing options doesn't set the billing address as per shipping address.

Appreciate your help.


texts:
I have checked my website in getmetrix tool,it is ngnix server.Site Page speed score is F(0%) showing

It shows

     Defer parsing of JavaScript - E(57)
     Leverage browser caching - F(0)

I studied but unable to get any solution. How to fix it.


texts: Hide out of stock configurable product options in color swatches

texts:
I'm trying to set configurable swatches for an attribute I use to create configurable products. I've prepared all required images for available options, placed them in wysiwyg/swatches folder.

Before enabling swatches from config, only "in stock" options is getting displayed in dropdown, out of stock products are hidden. After enabling swatches, all in stock and out of stock products are getting displayed one by one. I want  to hide not available options and only display available ones.

I've checked magento release notes (see in link below) and I guess they made a change in 1.9.3.0 to diplay all available options consistenly. How can I revert this?

http://devdocs.magento.com/guides/m1x/ce19-ee114/ce1.9_release-notes.html#ce19-1934


texts: Why changing the scope of quantity_and_stock_status from Global to Website level does not affect the Quantity and Stock Status field?

texts:
I have changed the scope of quantity_and_stock_status in Stores > Attributes > Product > from Global to Web Site:

But while creating new products or editing existing products the Quantity and Stock Status fields are still at the scope Global and changing value for one website affects the other website.

Note: This is a fresh Installation of Magento ver. 2.3.4


texts: Two modules overriding same files.How to make sure they work correctly?

texts: I have two modules installed in my store they both override billing.phtml and shipping.phtml due to which some steps in my checkout are missing OR say they are not functioning correctly.How can i fix this?


texts:
I need a little help again.
I been able to remove several stuff from the right sidebar, using local.xml, with no problem.

I want to remove the sales reorder the same way but it's not working. Can anyone give me a clue please?

Partial local.xml above.

    <reference name="right">
            <action method="unsetChild">
                <name>right.permanent.callout</name>
            </action>
            <action method="unsetChild">
                <name>catalog.compare.sidebar</name>
            </action>
            <action method="unsetChild">
                <name>right.poll</name>
            </action>
            <action method="unsetChild">
                <name>right.reports.product.viewed</name>
            </action>
            <action method="unsetChild">
                <name>right.catalog.compare.sidebar</name>
            </action>
            <action method="unsetChild">
                <name>right.cart.sidebar</name>
            </action>
            <action method="unsetChild">
                <name>right.sales.reorder.sidebar</name>
            </action>
</reference>


texts: How to add multiple simple products to cart with one click?

texts:
I'm trying to create a form to be able to add multiple simple products to the cart with one click like this page:

http://www.bikebandit.com/oem-parts/2015-honda-cbr1000rr/o/m156896#sch907940

all the similar questions I have seen either have no answers are for different versions or suggest using ajax [we are not using ajax]

How can Magento be configured to be able to add multiple products WITH amounts to the cart with one click?


texts: Rewrite model to prevent changing shipping method at review order stage of checkout

texts:
I'm trying to override a model class to prevent customers changing the shipping address and method at the (final) order review stage of checkout, using this suggestion. This is the point at which the customer has been returned from PayPal in order to check over the order before finally clicking the 'Place Order' button. We pre-agree shipping costs with our customers via a quotation so giving them the option to change shipping method doesn't make any sense.

This is my first attempt at doing this in Magento. It feels like I'm nearly there but it's not working:

If anyone with experience of overriding model classes in Magento could tell me where I'm going wrong that would be fantastic.

(1)
(a) Create /app/code/local/Lms/Paypal/Model/Express and copy in /app/code/core/Mage/Paypal/Model/Express/Checkout.php

(b) Rename class in Checkout.php from: Mage_Paypal_Model_Express_Checkout
to: Lms_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout

(c) Clear out the class body and replace with just this function:

/**
 * Check whether order review has enough data to initialize
 *
 * @param $token
 * @throws Mage_Core_Exception
 */
public function prepareOrderReview($token = null)
{
    parent::prepareOrderReview($token);
    $this->_quote->setMayEditShippingAddress(false);
    $this->_quote->setMayEditShippingMethod(false);
    $this->_ignoreAddressValidation();
    $this->_quote->collectTotals()->save();
}

(2)
(a) Now create dir /app/code/local/Lms/Paypal/etc/
(b) Create Config.xml file in that dir and put this code there:

<?xml version="1.0"?>
<config>
    <modules>
        <lms_paypal>
            <version>0.1</version>
        </lms_paypal>
    </modules>
    <global>
       <models>
          <paypal>
              <rewrite>
                  <express>Lms_Paypal_Model_Express</express>
              </rewrite>
          </paypal>
       </models>
    </global>
</config>

(3)
(a) Now go to /app/etc/modules/
(b) Create Lms_Paypal.xml in that dir and put this code in Lms_Paypal.xml:

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


texts: Magento 2 - Move swatch-options at the bottom

texts:
I try to move swatch-options in the product page at the bottom of the page, before "Write a review" zone, I use this code:

 <move element="product.info" destination="content" before="product.info.review"/>

but after this "Add to Wishlist" disappear.

What I can do to have the wishlist button?


texts: Get product collection in Magento2 root file

texts:
I need product collection In my root file so

How can I get the product collection in my root file in Magento2?


texts:
Could someone help me with the following issue I have with a module? I've been stuck for a couple of hours and could do with a fresh perspective.

I have two modules ModuleA and ModuleB which both extend the same Onepage_Checkout class using rewrites. I've almost solved the issue of the rewrite but I have run into two issues.

The first is that ModuleA and ModuleB both add a step to Onepage Checkout. Each additional step is visible but for some reason, ModuleB is skipped and doesn't become active.

The second is I need to add an option to disable or enable ModuleA per store/website

I've added this code to the system.xml file but it doesn't seem to work

<enable translate="label">
          <label>Enable</label>
          <frontend_type>select</frontend_type>
          <source_model>adminhtml/system_config_source_yesno</source_model>
          <sort_order>10</sort_order>
          <show_in_default>1</show_in_default>
          <show_in_website>1</show_in_website>
          <show_in_store>1</show_in_store>
        </enable>

Do I need to alter the DB table in any way or is there something else that I have missed?

Also, if I disable ModuleB for StoreA and disable ModuleA for storeB due to dependencies will they both still be active in either store? The reason I ask is I need to have the flexibility to enable or disable each module per store and not have them both active...

Can anyone assist? I really appreciate it...


texts: magento 2 minicart only loading on cart page

texts:
This is the minicart on cart page

But on other pages its just this

Could someone please suggest what could be going wrong.

It's a custom theme build on blank theme.


texts:
I have uploaded an image of a new favicon in the following:

System -> Configuration -> Design -> HTML Head -> and uploaded it into Favicon Icon.

I have applied it to both Store View & Website View.

I have waited a while and yet no signs of it being changed. Could anyone please advise me what I should do in this case?


texts: How to downgrade Magento 2 to Magento 1?

texts:
How to downgrade Magento 2.1 to magento 1.9?

How to do that automatically instead of obvious export/import path?

Looking for an expert opinion, please no 'why do you need that?' questions.


texts:
Does anybody here know how to change SEO link In the footer?

I installed a extension for Sitemap and I want to link it to

www.mywebsite.com/sitemap

instead of the default link

www.mywebsite.com/catalog/seo_sitemap/category


texts: Magento 2 - Syntax error on bin/magento support:backup:db

texts:
I am trying to get backup of DB using following command

php -dmemory_limit=1G bin/magento support:backup:db

It is giving me syntax error:

sh: 2: Syntax error: word unexpected (expecting ")")
Error: Command returned non-zero exit code:
`(/usr/bin/nice -n 15 /usr/bin/mysqldump -uxxxx -hxxxx  -p"xxxx" xxxx --skip-extended-insert  customer_entity customer_entity_varchar customer_address_entity customer_address_entity_varchar customer_grid_flat quote quote_address sales_order sales_order_address sales_order_grid 2>&1 | /usr/bin/php -r 'while ($line=fgets(STDIN)) {
           if (preg_match("/(^INSERT INTO\s+\S+\s+VALUES\s+)\((.*)\);$/",$line,$matches)) {
               $row = str_getcsv($matches[2],",","\x27");
               foreach($row as $key=>$field) {
                   if ($field == "NULL") {
                       continue;
                   } elseif ( preg_match("/[A-Z]/i", $field)) {
                       $field = md5($field . rand());
                   }
                   $row[$key] = "\x27" . $field . "\x27";
               }
               echo $matches[1] . "(" . implode(",", $row) . ");\n";
               continue;
           }
           echo $line;
       };';

I didn't tried this command before and never faced this type of error, can anyone guide me how can I resolve this error?


texts: Getting an error message when trying to create an account or login

texts:
We are getting the error message you see below. This happens when trying to login or create a new account. Does anyone know a fix for this?

Fatal error: Call to a member function setMessageBody() on a non-object in
/home/skeleton/public_html/app/code/core/Mage/Core/Model/Email/Template.php on line 411


texts: How can I dentify or select cms_blocks that are associated with certain cms_page

texts:
I am trying to pull cms blocks that belong to a certain page. i saw that blocks are stored in cms_block and pages stored in cms_page. I tried to create a query that might help me pull this data.

SELECT cms_block.title FROM cms_page INNER JOIN cms_block ON cms_page.page_id = cms_block.block_id;

and

SELECT cms_page.title FROM cms_page INNER JOIN cms_block ON cms_page.page_id = cms_block.block_id;

with both of these queries I do get some results. But I suspect that the results are not accurate because when i try to load cms page and cms block using either page_id or block_id with same id. the pages that comes up are  totally not related.

Example:

http://domain/index.php/admin/cms_page/edit/page_id/7/ loads unrelated data compared with that following block;

http://domain/index.php/admin/cms_block/edit/block_id/7/


texts: Confuse when choose which class to extends

texts:
Dive in thousand classes , interfaces maybe more.
How to decide which one to extend while create model or constructors.. to build module from scratch
Sometimes it makes me so confuse. It too many
Anyone can give me advice


texts: Get Configurable Product Price When Using Lowest Price Simple Extension

texts:
I am showing the Lowest price simple product price on the configurable product using the extension (organicinternet/magento-configurable-simple).

When I echo $product->getPrice() for the configurable product ID is will show the lowest price simple product price.

The actual price of the configurable product is £99.99, how do I get this value?

I need to compare the configurable price and the lowest price simple.

can this be done?


texts: Send multiple package shipment to fedex in Magento?

texts:
I am trying to pass multiple package weight in app/code/local/Mage/Usa/Model/Shipping/Carrier/Fedex.php , when the shipping package weight is greater than 150 Lbs. Currently it showing Freight charges if package weight is greater than 150 Lbs. What I am trying to do is whenever the package weight is more than 150 Lbs for ex.- 374 Lbs, Then the weight will divide into smaller packages like (150 , 150 , 74). And that's the way to avoid freight charges in fedex shippment.

After some debugging I found that weight is passing in request like this in my fedex.php file.

<?php $ratesRequest = array(
            'WebAuthenticationDetail' => array(
                'UserCredential' => array(
                    'Key'      => $r->getKey(),
                    'Password' => $r->getPassword()
                )
            ),
            'ClientDetail' => array(
                'AccountNumber' => $r->getAccount(),
                'MeterNumber'   => $r->getMeterNumber()
            ),
            'Version' => $this->getVersionInfo(),
            'RequestedShipment' => array(
                'DropoffType'   => $r->getDropoffType(),
                'ShipTimestamp' => date('c'),
                'PackagingType' => $r->getPackaging(),
                'TotalInsuredValue' => array(
                    'Amount'  => $r->getValue(),
                    'Currency' => $this->getCurrencyCode()
                ),
                'Shipper' => array(
                    'Address' => array(
                        'PostalCode'  => $r->getOrigPostal(),
                        'CountryCode' => $r->getOrigCountry()
                    )
                ),
                'Recipient' => array(
                    'Address' => array(
                        'PostalCode'  => $r->getDestPostal(),
                        'CountryCode' => $r->getDestCountry(),
                        'Residential' => (bool)$this->getConfigData('residence_delivery')
                    )
                ),
                'ShippingChargesPayment' => array(
                    'PaymentType' => 'SENDER',
                    'Payor' => array(
                        'AccountNumber' => $r->getAccount(),
                        'CountryCode'   => $r->getOrigCountry()
                    )
                ),
                'CustomsClearanceDetail' => array(
                    'CustomsValue' => array(
                        'Amount' => $r->getValue(),
                        'Currency' => $this->getCurrencyCode()
                    )
                ),
                'RateRequestTypes' => 'LIST',
                'PackageCount'     => '1',
                'PackageDetail'    => 'INDIVIDUAL_PACKAGES',
                'RequestedPackageLineItems' => array(
                    '0' => array(
                        'Weight' => array(
                            'Value' => $weight,
                            'Units' => 'LB'
                        ),
                        'GroupPackageCount' => 1
                    )
                )
            )
        ); ?>

and array of multiple package weight which I'm getting is like -

<?php
Array(
[0] => 150,
[1] => 150,
[2] => 74
) ?>

But not getting how can I pass this array of multiple weight in Fedex weight.

Please help me to do this. Any suggestion would be appreciate.


texts:
Created a new template and it's showing in the back end, but the CSS and JS files are not loading.

The default theme blank/luma works fine, but when I select new theme then CSS, JS is not loading and when I run the following commands

php bin/magento setup:static-content:deploy

I get the following Compilation from source:

  frontend/MyStore/MyAbstract/en_US/css/styles-l.less variable
  @button__shadow-active is undefined in file
  /chroot/home/installs/xxxxxxx/html/var/view_preprocessed/css/frontend/MyStore/MyAbstract/en_US/css/source/_extends.less
  in _extends.less on line 37, column 30 35| } 36| &:active { 37|
  .lib-css(box-shadow, @button__shadow-active); 38| } 39| } 40| >


texts: Magento 1.9.3 Connect Manager not working

texts:
Everytime I try to install an extention via Connect Manager, and right after I click on the Install button, it ask me for the login again. But then the login is not working anymore. What happened here?

See screenshot.


texts: How to get store admin email address and name in Magento 2?

texts:
I want replacement of the following in magento 2

/* Name */
Mage::getStoreConfig('trans_email/ident_sales/name');
/* Email */
Mage::getStoreConfig('trans_email/ident_sales/email');

or similar to getting current store admin name and email.

Thanks.


texts: I want summary count in .phtml file with cache enable.


texts: requirejs-config.js compiling with wrong code

texts:
Magento 2.1.4 with an nginx setup creates an extra line of code  in pub/static/_requirejs/adminhtml/Magento/backend/en_US/requirejs-config.js after compiling the static content:

require.config({"baseUrl":"http:///pub/static/frontend/Magento/luma/en_US"});

I am using a custom theme, and not using Luma.  And I have no references to Luma in the magento install.  This code sets my base URL wrong and creates lots of bad URLs in the admin, thus admin does not work.  If I delete the line of code the URLs load fine, and admin works.

If I compile the static files on an apache server, the requirejs-config.js compiles without that line of code, and everything works.

What would be making this code appear?  Where would the code be coming from as I do not have any Luma references?


texts: How to debug custom theme layout in magento 2

texts:
Today when i check var/system.log

[2015-10-26 19:43:28] main.CRITICAL: Broken reference: the
'page.bottom' element cannot be added as child to
'page.bottom.container', because the latter doesn't exist [] []
[2015-10-26 19:43:28] main.INFO: Cache file with merged layout:
LAYOUT_frontend_STORE3_4d41d8cd98f00b204e9800998ecf8427e: Please
correct the XML data and try again.  [] []

Anyone have any clues about fix this problems. Homepage and category page is fine but product detail get empty blank
I have check all layout in my theme but not found any error. All layout files copy from app/code/Magento
I'm using magento master 1.0 beta
You can see my theme from github


texts: Pass data from Controller into .phtml file

texts:
A page is submitted with the Voucher Number to check if it is valid, and if it is, then it the user moves forward in the process. How can I pass this value to the phtml to use again? Preferably I would like to pass it back as part of the model.

   public function execute()
    {
        // Get submitted voucher number
        $voucherNumber = $_POST['voucher-number'];

        // Validate the voucher number
        if($this->_objectManager->create('Hidden\Hidden\Helper\VoucherHelper')->validate($voucherNumber)){
            // Valid
            // ******** NEED TO RETURN $voucherNumber here
            return $this->resultPageFactory->create();
        }
        else {
            // Invalid
            return $this->_redirect('hidden/voucher');
        }
    }

I'm aware of this answer and this answer but both are related to Magento 1 and I want to make sure that they are still correct now. Further more these are related to blocks and I would think (although wrongly possibly) I can pass the model in from the controller action?


texts: How to add multiple cart buttons with multiple quantities in cart Magento?

texts:
I have added to add 3 to cart and add to cart buttons.In this buttons, I clicked add 3 to cart added 3 quantities and add to cart button also added 3 quantities.My requirement is only added 3 to cart button add only 3 quantities and remaining buttons added only one quantity.Can you please help me?
for example is below.
Add 3 to cart->add 3 quantities
Add to cart->add one quantity
Buy now ->add one quantity
Can you please help me?


texts:
I tried to install  Ultimate Module Creator by key https://www.magentocommerce.com/magento-connect/ultimate-module-creator.html

show this error when try to access admin ..

Fatal error: Class 'Ultimate_ModuleCreator_Helper_Data' not found in /home/producttest/public_html/app/Mage.php on line 547

Note: :  I clean caches
extension is developed by marius


texts: User registration error in Magento 2 B2B module

texts:
I have installed Magento 2 B2B module via composer. after install, I tried to create the new user in the frontend. But I got the below error.

Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Company\Model\Customer\Company\Interceptor::createCompany() must be of the type array, string given, called in /app/vendor/magento/module-company/Model/Plugin/AccountManagement.php on line 119 and defined in /app/generated/code/Magento/Company/Model/Customer/Company/Interceptor.php:20 Stack trace: #0 /app/vendor/magento/module-company/Model/Plugin/AccountManagement.php(119): Magento\Company\Model\Customer\Company\Interceptor->createCompany(Object(Magento\Customer\Model\Data\Customer), 'kmgkumar', NULL) #1 /app/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Company\Model\Plugin\AccountManagement->afterCreateAccount(Object(Magento\Customer\Model\AccountManagement\Interceptor), Object(Magento\Customer\Model\Data\Customer), Object(Magento\Customer\Model\Data\Customer), 'admin@123', 'https://b2bmodu...') #2 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\AccountManagement\Interceptor->Magento\Framework\Int in /app/generated/code/Magento/Company/Model/Customer/Company/Interceptor.php on line 20


texts: Rewrite catalog_product_review controller does nothing

texts:
I tried rewrite catalog_product_review controller in admin but failed. I'm not aware of problem. Does anyone know problem maybe help me?

Thanks

config.xml:

<config>
    <modules>
        <Hn_Mymodule>
            <version>0.1.0</version>
        </Hn_Mymodule>
    </modules>
     <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <mymodule before='Mage_Adminhtml'>Hn_Mymodule</mymodule>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

Hn/Mymodule/controllers/Adminhtml/Catalog/Product/ReviewController.php

require_once 'Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php';

class Hn_Mymodule_Adminhtml_Catalog_Product_ReviewController extends Mage_Adminhtml_Catalog_Product_ReviewController{

    public function indexAction()
    {
        echo "test index";
    }

    public function saveAction()
    {
        echo "test save";
    }

}


texts:
We're using Magento 1.8 with Turpentine + Varnish + Redis on Debian with nginx.

Sometimes it happens that the checkout is cached and you can see the info from a previous customer. In the .vcl-file the checkout is blocked, but this still happens. Any ideas how thats possible?


texts:
How can I disable the tooltip in Magento 2? I try to go

Admin panel Stores -> Configuration -> Catalog -> Catalog ->Storefront ->Show Swatch Tooltip close it.

but still not working.


texts: How to remove SID (session ID) from URL in Magento 2

texts:
How to remove the session ID from the URL in Magento 2 (frontend). This is the SID query parameter in the URL.

For example: https://example.com/contact/?SID=sfl317buq8ru4uf4a...

Removed starting from 2.3.3 https://github.com/magento/magento2/issues/25663


texts: Magento 2 - make head element translatable

texts:
I wish to translate the "Forgot Your Password" string which is created as a head and body element on the Forgotten password page. I found that this string is generated via xml in:

Magento_Customer/layout/customer_account_forgotpassword.xml

inside title tags.

The local translation csv file doesn't translate this string.
I have also tried to make this xml element translatable with translate="true" but it is not working. It is working if i edit this string directly within the xml, but that's a dirty hack.

Also i couldn't find appropriate solution within official documentation


texts: Add database getting error SQLSTATE[HY000] [2002] No such file or directory

texts:
I tried to install Magento using XAMPP for Linux (I use 32-bit Ubuntu), I've created a database, and when you want to add via Magento Installer I get an error message like this:

I've tried a variety of ways, but it does not work, is there a solution?


texts: Magento2 : How to translate attribute group Label?

texts:
In magento we can translate attribute label by store.
But how can we translate Attribute Group Label

By default label will be same for all store as there is no option for set label by Store.


texts: when Iam trying to access Magento admin page, the page does not loaded instead XAMPP home page has been loaded.


texts: how to fix "Cannot send headers; headers already sent in

texts:
a:5:{i:0;s:119:"Cannot send headers; headers already sent in
  /home/stepup441/public_html/app/code/core/Mage/Core/functions.php,
  line 60";i:1;s:1029:"#0
  /home/stepup441/public_html/lib/Zend/Controller/Response/Abstract.php(115):
  Zend_Controller_Response_Abstract->canSendHeaders(true)

1 /home/stepup441/public_html/app/code/core/Mage/Core/Model/App.php(1265): Zend_Controller_Response_Abstract->setHeader('Content-Type', 'text/html; char...')
2 /home/stepup441/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(80): Mage_Core_Model_App->getResponse()
3 /home/stepup441/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(202): Mage_Core_Controller_Varien_Front->getResponse()
4 /home/stepup441/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
5 /home/stepup441/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
6 /home/stepup441/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
7 /home/stepup441/public_html/index.php(83): Mage::run('', 'store')
8 {main}";s:3:"url";s:10:"/index.php";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}


texts: How to show grand total amount in english words Magento 2 invoice pdf?

texts: In Magento 2 invoice pdf, how can I show grand total amount in english words also? How can I achieve this?


texts: Magento Product Data Import causing blocked IP

texts:
It seems that since applying patch SUPEE-7045, we are having our office IP address blocked by our hosting provider whenever we do a product data import (via CSV, using Dataflow Profile).

Watching the progress of records being processed, it seems to pause at/after each 6th record, before continuing.

Checking Error Log via our cPanel, we see the following:

mod_hive matched URI example.com/.../xyz.csv/ (repeated 6 times)
mod_hive client reached the maximum connections(6) per URI example.com/.../system_convert_gui/batchRun/key/.../home/.../public_html/index.php for 10 seconds, referer: example.com/index.php/.../system_convert_gui/run/id/3/key/.../files/import-20160216014458-1_XXX.csv/

The above is repeated X number of times, e.g. repeated 8 times if we had 48 products.

Our first occurrence of the issue saw our 200-product import start error-ing out at around 40-something records; subsequent imports have been 58 products, and have completed successfully, with the blocking happening anytime within 90 seconds of import finishing.

Our hosting provider say they start blocking IP addresses if they see 20 or so multiple connections, given it is a sign of potential hacking.  Not sure how the 20 vs 6 adds up, but does seem related.

They suggested to remove "admin" from our admin URL (we had some codified prefix + "admin"), which we tried but still got blocked.

They say nothing has changed in their server settings.  We have not changed anything either, and we've successfully imported 100s of products in the past.  It seems only since that Magento patch we have these problems.

Does anyone have a clue as to if Magento connection behaviour has changed (generally, or specifically to dataflow)?  What code could I be fixing?  I've never even heard of Hive before now (referring to that "mod_hive" in the error log).

Have read through the patch notes, and although some items appear semi-related, nothing strikes me as the right place to start looking.


texts: 500 Internal Server Error during onepage checkout saveShippingMethod

texts:
Hi I have problem in my onepage checkout. I can't choose pay method because ajax all time is reload. In console I have 500 (Internal Server Error)  (in adress onepage/json/saveShippingMethod. I can't find this controller. In exception log I have 'Mage_Core_Exception' with message

  'Mage registry key "themeMediaUrl" already exists' in
  /var/www/home/mmuzyka/byinsomniabiz/app/Mage.php:595. Do you have any
  hints?

edit: I have the same issue and I change code from this case but not work. Stripe don't work on IWD OPC


texts: Magento 2.3: Getting the salable quantity via SQL

texts:
I'm trying to get all stock data of a product via SQL for debugging.
The part that I'm not 100% on is the salable quantity.

Here is what I have:

SELECT t1.`quantity` + SUM(t2.`quantity`) salable_quantity
FROM `inventory_source_item` t1
JOIN `inventory_reservation` t2
ON t1.`sku` = t2.`sku` AND t1.`status` = 1
WHERE t1.`sku` = 'MY-PROD-SKU'

this works most of the time, and sometimes returns NULL.

I was hoping if any magento users had to write something similar, and have any improvements on this query. Thanks.

EDIT:

Improved version of my code:

SELECT COALESCE(t1.`quantity` + SUM(t2.`quantity`), 0) salable_quantity
FROM `inventory_source_item` t1
JOIN `inventory_reservation` t2
ON t1.`sku` = t2.`sku` AND t1.`status` = 1
WHERE t1.`sku` = 'MY-PROD-SKU'


texts:
I have a block that replaces the default Magento login form. I would like to conditionally display it, or else revert to the default login form. I am using ifconfig to display the block if a certain configuration variable is set:

<block class="Namespace\Module\Block\Form\LoginFormClass" name="module_form_login" template="Module::login_page.phtml" ifconfig="module_config/login/enable">
    <arguments>
        <argument name="display" xsi:type="string">embed</argument>
    </arguments>
</block>

However, what this does is just hide or show the block. When the configuration is disabled, the block is hidden, but the default Magento login form does not appear. The customer_account_login.xml has additional elements (referenceContainer/referenceBlock etc.) that don't have a valid ifconfig parameter.

Is it possible to only activate the entire override conditionally, and display the default login form if the condition is not met?


texts: Magento : Mass Uploading Qty by sku - Become Out of Stock - 2

texts:
mass uploading qty by sku but need to change code to "Qty for Item's Status to Become Out of Stock - 2" as thats what we have set global.

public function _updateStocks($data){
    $connection     = $this->_getConnection('core_write');
    $sku            = $data[0];
    $newQty         = $data[1];
    $productId      = $this->_getIdFromSku($sku);
    $attributeId    = $this->_getAttributeId();

    $sql            = "UPDATE " . $this->_getTableName('cataloginventory_stock_item') . " csi,
            " . $this->_getTableName('cataloginventory_stock_status') . " css
            SET
            csi.qty = ?,
            csi.is_in_stock = ?,
            css.qty = ?,
            css.stock_status = ?
            WHERE
            csi.product_id = ?
            AND csi.product_id = css.product_id";
            $isInStock      = $newQty > 0 ? 1 : 0;
            $stockStatus    = $newQty > 0 ? 1 : 0;
            $connection->query($sql, array($newQty, $isInStock, $newQty, $stockStatus, $productId));


texts: I have created tons of products without setting the weight. Now I would like to add the weight, same weight to all products. Can a sql query help me? Is there some other solution.


texts: Show Category CMS block only on first category page

texts:
I'm using Magento 1.9 and struggling on one thing. I have a CMS block in my category page but I want it to show only on the first page! So if I scroll down and move to page 2 on the same category I don't want to see that CMS block again. I tried to put this code in the CMS block... but it ignores me (category-accordion.accordion is the main div of the CMS block)

I changed the catalog/category/view.phtml as follows but it seems that Magento checks the condition only in the first page because it keeps the block on all the other pages...

I'm using Magento 1.9 and struggling on one thing. I have a CMS block in my category page but I want it to show only on the first page! So if I scroll down and move to page 2 on the same category I don't want to see that CMS block again. I tried to put this code in the CMS block... but it ignores me (category-accordion.accordion is the main div of the CMS block)

I changed the catalog/category/view.phtml as follows but it seems that Magento checks the condition only in the first page because it keeps the block on all the other pages...

if($this->isContentMode()) {
echo $this->getCmsBlockHtml();
}
else if($this->isMixedMode() && strpos($_SERVER['REQUEST_URI'], '?=p') == false) {
echo $this->getCmsBlockHtml();
echo $this->getProductListHtml();
}
else {
echo $this->getProductListHtml();
}


texts: How can I add categories to search suggestions in magento 2.3

texts:
Am using elastic search as the search engine.
Can anyone tell me how can I extend the search suggestions in Magento 2.3.1 to add the categories in search suggestion?
Any small help or clue will be appreciated. Thanks!


texts: Magento 2.3.4 - at checkout: Something went wrong with your request. Please try again later

texts:
For some wired reason my Magento stopped working at checkout.
As soon as I go to checkout I get that error. Shipping is not calculated anymore in the frontend, but it works in the admin when taking orders by phone.

Anyone seen that error?

Edit: if you want to see the error go to: www.gmsoap.com

To answer the first comment, this is the output from the system.log

[2020-05-01 17:50:25] main.INFO: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'custom.sidebar.content' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'author-link' element cannot be added as child to 'customer_account_navigation', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'custom_info.order.success' element cannot be added as child to 'order.success.additional.info', because the latter doesn't exist [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'minicart' tries to reorder itself towards 'logo', but their parents are different: 'header-wrapper' and 'header' respectively. [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'custom.sidebar.content' tries to reorder itself towards '', but their parents are different: 'sidebar.additional' and '' respectively. [] []
[2020-05-01 17:50:25] main.INFO: Broken reference: the 'custom_info.order.success' tries to reorder itself towards '', but their parents are different: 'order.success.additional.info' and '' respectively. [] []
[2020-05-01 17:50:28] main.INFO: Broken reference: the 'mgs.instant.search.autocomplete' element cannot be added as child to 'top.search', because the latter doesn't exist [] []
[2020-05-01 17:50:29] main.INFO: Broken reference: the 'mgs.instant.search.autocomplete' element cannot be added as child to 'top.search', because the latter doesn't exist [] []
[2020-05-01 17:50:29] main.ERROR: Topic "inventory.source.items.cleanup" is not configured. [] []
[2020-05-01 17:50:29] main.ERROR: Topic "inventory.source.items.cleanup" is not configured. [] []


texts: Upload and analyze qr code in magento 2.2

texts: Do you know any class, library or sample to upload a file containing a qr code and extract the data string from the qr code


texts: File validation failed. Upload Images magento 2

texts:
Getting an error File validation failed. when trying to upload JPG format images from cms block in Magento 2.3 version. File Path : vendor/magento/module-cms/etc/di.xml

    <argument name="extensions" xsi:type="array">
        <item name="allowed" xsi:type="array">
            <item name="jpg" xsi:type="string">image/jpg</item>
            <item name="jpeg" xsi:type="string">image/jpeg</item>
            <item name="png" xsi:type="string">image/png</item>
            <item name="gif" xsi:type="string">image/gif</item>
            <item name="svg" xsi:type="string">image/svg+xml</item>
        </item>
        <item name="image_allowed" xsi:type="array">
            <item name="jpg" xsi:type="string">image/jpg</item>
            <item name="jpeg" xsi:type="string">image/jpeg</item>
            <item name="png" xsi:type="string">image/png</item>
            <item name="gif" xsi:type="string">image/gif</item>
            <item name="svg" xsi:type="string">image/svg+xml</item>
        </item>
        <item name="media_allowed" xsi:type="array">
            <item name="flv" xsi:type="string">video/x-flv</item>
            <item name="swf" xsi:type="string">application/x-shockwave-flash</item>
            <item name="avi" xsi:type="string">video/x-msvideo</item>
            <item name="mov" xsi:type="string">video/x-sgi-movie</item>
            <item name="rm" xsi:type="string">application/vnd.rn-realmedia</item>
            <item name="wmv" xsi:type="string">video/x-ms-wmv</item>
        </item>
    </argument>


texts: System Config Multiselect default all selected

texts:
I have a system config field of type multiselect which will be populated using the catalog/product_attribute_collection. This is a part of the system.xml that defines it.

  <attributes>
       <label>Choose Attributes to JSONize</label>
       <frontend_type>multiselect</frontend_type>
       <sort_order>3</sort_order>
       <show_in_default>1</show_in_default>
       <show_in_website>1</show_in_website>
       <show_in_store>1</show_in_store>

<source_model>package_module/system_config_attributes</source_model>
  </attributes>

Now I want all of the values in the multiselect to be selected by default. Since the default values for system config are defined in the config.xml, I'm not sure how to choose all as default.

This is the section of config.xml which is relevant to the question

<default>
    <mytab>
        <mysection>
            <attributes><!-- ***WHAT SHOULD I WRITE HERE*** --></attributes>
        </mysection>
    </mytab>
</default>


texts: How can i output all loaded reference names

texts:
How can i get a var_dump'd list of all loaded reference names for a page (hack a core file temporarily).

I'm attempting to load a block that injects some javascript ajax stuff and it uses a url stored in the magento custom variables.  This forces me to use a block with php that echos the magento custom variable, and then show it in the block "varinject".

I'm trying to determine which references are loaded on any page I am on... for instance, my block is loaded like this in my design layout xml...

<layout>
<default>
    <reference name="head">
        <action method="addJs">
            <script>nki_customer.js</script>
        </action>
        <action method="addCss">
            <name>nki_customer.css</name>
        </action>
    </reference>
    <!--Magento omits the ->getChildHtml() from head, so you HAVE to use something else to render blocks-->
    <reference name="content">
        <block type="nki_customer/adminhtml_varinject" name="nki_customer_varinject" template="nki_customer/varinject.phtml"/>
    </reference>

</default>

The thing is, I know that in magento admin, 'head' does not load child html.  For unknown reasons (probably to purchase enterprise) they do not do that.  'Content' does, but it is not used everywhere.

I am not going to modify nor override core design files at this time, so please no suggestions to add $this->hildHtml() to the admin head phtml file.

I would love to know which core file I can open and just add a good ol' var_dump($something) and it will throw a giant list of the references used on the page.


texts: PayPal Express Checkout not working in Magento 1.9.2.4 and 1.9.3

texts:
I can only speak for versions 1.9.2.4 and 1.9.3.3 because those are the only ones I've tried this with, but I suspect this issue appears in other versions also.

Several things I've noticed when using PayPal Express Checkout:

Transferring shipping options does not always work, and the call-back always takes a really long time.

A user clicks to checkout with PayPal, they arrive at PayPal's site and the shipping options (when they work) take a while to load. Sometimes they don't load at all -- nor does the indicator even suggest that a call-back is requesting the shipping options.

When the options do load this approach can result in a successful order, but it's hit-or-miss.
Not transferring shipping options re-routes the user back to a strange/broken order review screen in Magento. The header of the site is rendered twice. There is an option to select shipping, but once that's done the page redraws with another selector to select the shipping option again. It's just broken.

This approach can never result in a successful order being placed.
If a PayPal order ever is placed, the "Last 5 Orders" box on the Dashboard does not display any customer information -- it's just a blank row.

Also, in the order details, the comment history has an entry with what appears to be bad data:

Authorized amount of $50.00. Transaction ID: '29348328IJD9302".

Why is the "Transaction ID" displaying HTML -- shouldn't this just be the value?

I'm less concerned with #3, but does anyone know what's going on and if there is a way to resolve #1 or #2?

Thank you


texts:
how can I change the default sorting order from the position to the order of the category ?

In my result, I have some product of the Category 2 that appeared before the Category 1 (probably because I've added second category after the second, and it displayes the last added products at first).

Knowing that I've added some product from the C1 during I was doing the C3.

I want to show C1, C2 and C3 in that order.

As you see I have a lot of product, so I can do this manually.

EDIT :

Programmaticaly, I've found this method in Magento/CatalogSearch/Block/Result

    /**
 * Set search available list orders
 *
 * @return $this
 */
public function setListOrders()
{
    $category = $this->catalogLayer->getCurrentCategory();
    /* @var $category \Magento\Catalog\Model\Category */
    $availableOrders = $category->getAvailableSortByOptions();
    unset($availableOrders['position']);
    $availableOrders['relevance'] = __('Relevance');
    $this->getListBlock()->setAvailableOrders(
        $availableOrders
    )->setDefaultDirection(
        'desc'
    )->setDefaultSortBy(
        'relevance'
    );
    return $this;
}

I've changed this :

        $this->getListBlock()->setAvailableOrders(
        $availableOrders
    )->setDefaultDirection(
        'desc'
    )->setDefaultSortBy(
        'relevance'
    );

by this

        $this->getListBlock()->setAvailableOrders(
        $availableOrders
    )->setDefaultDirection(
        'desc'
    )->setDefaultSortBy(
        'category'
    );

But I don't know if it's a reliable solution. Any thoughts ?


texts: Module menu is not displayed in admin panel magento 2

texts:
menu.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Ronis_Contactus::contactus" title="Contact us" translate="title" module="Ronis_Contactus" sortOrder="20" dependsOnModule="Ronis_Contactus" resource="Ronis_Contactus::contactus"/>
        <add id="Ronis_Contactus::ronis_contactus" title="Grid" translate="title" module="Ronis_Contactus" sortOrder="10" parent="Ronis_Contactus::contactus" action="contactus" resource="Ronis_Contactus::contactus"/>
    </menu>
</config>

acl.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Ronis_Contactus::contactus" title="Contact us" translate="title" sortOrder="30">
                </resource>
            </resource>
        </resources>
    </acl>
</config>


texts:
I have a strange problem.

When I am logged and try to add an item to the cart I receive an error message (We can't add this item to your shopping cart right now. logged).

if i try when unlogged it work perfectly.

 /vendor/magento/zendframework1/library/Zend/Cache/Backend
and edit the file.php

Search for

'cache_dir' => null,
 and replace it with
'cache_dir' => 'var/cache',

Not work after replace this code

How can i solve the problem?


texts: What is the Difference Between Tax Class : Texable Goods And Shipping

texts: In my store i set shipping rates for individual states and countries based on zipcodes. Pls guide me what i select in the stage of tax class.


texts: How can i add item in magento 2 cart without login ?


texts: How to disable an UI component field while add new item and enable while editing?

texts:
Hi i'm new at magento 2 and i want to disable Ui Component field while creating item, and enable the field while editing.

Well, following this tutorial: Disabling a UI component field upon condition in Magento 2

The tutorial is the opposite of what i was looking out, it only works to Disable while editing and not while add. I want to disable while add, and enable while editing.

DataProvider:

class DataProvider extends AbstractDataProvider

{
    /**
     * @var ResourceModel\Data\Collection
     */
    protected $collection;

/**
 * @var DataPersistorInterface
 */
protected $dataPersistor;

/**
 * @var array
 */
protected $loadedData;

/**
 * @param string $name
 * @param string $primaryFieldName
 * @param string $requestFieldName
 * @param CollectionFactory $pageCollectionFactory
 * @param DataPersistorInterface $dataPersistor
 * @param array $meta
 * @param array $data
 */
public function __construct(
    $name,
    $primaryFieldName,
    $requestFieldName,
    CollectionFactory $pageCollectionFactory,
    DataPersistorInterface $dataPersistor,
    array $meta = [],
    array $data = []
) {
    $this->collection    = $pageCollectionFactory->create();
    $this->dataPersistor = $dataPersistor;
    $this->meta          = $this->prepareMeta($this->meta);
    parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
}

/**
 * Prepares Meta
 *
 * @param array $meta
 * @return array
 */
public function prepareMeta(array $meta)
{
    return $meta;
}

/**
 * Get data
 *
 * @return array
 */
public function getData()
{
    if (isset($this->loadedData)) {
        return $this->loadedData;
    }
    $items = $this->collection->getItems();
    foreach ($items as $page) {
        $this->loadedData[$page->getId()] = $page->getData();
    }
    $data = $this->dataPersistor->get('module_messages');
    if (!empty($data)) {
        $page = $this->collection->getNewEmptyItem();
        $page->setData($data);
        $this->loadedData[$page->getId()] = $page->getData();
        $this->dataPersistor->clear('module_messages');
    }

    if($_SESSION['action'] == 'edicao' AND isset($page)){
        $this->loadedData[$page->getId()]['do_we_hide_it'] = true;
    }
    return $this->loadedData;
}

}

form.xml

<field name="nome_header" formElement="input">
        <argument name="nmh" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">nmh</item>
            </item>
        </argument>
        <settings>
            <imports>
                <link name="disabled">${ $.provider}:data.edit</link>
            </imports>
            <validation>
                <rule name="required-entry" xsi:type="boolean">false</rule>
            </validation>
            <dataType>text</dataType>
            <label translate="true">Nome Header</label>
            <dataScope>nome_header</dataScope>
        </settings>
    </field>


texts: Run specific class function using cron in magento 2

texts:
We can run model/observer function using cron as below in magento 1:

<crontab>
     <jobs>
         <CronCheck>
            <schedule>
                <cron_expr>*/15 * * * *</cron_expr>
            </schedule>
            <run>
                <model>khaosconnect/Observer::checkCronJobs</model>
            </run>
         </CronCheck>
    </jobs>
</crontab>

so checkCronJobs function executed according to scheduled cron job.

In magento2 how we can run the specific class function using cron?
As we have use below in magento 2 :

<?php

namespace Company\Module\Cron;
class Runcronjobs
{
   protected $_logger;
   public function __construct(
       \Psr\Log\LoggerInterface $logger
   )
    {
        $this->_logger = $logger;
    }

   public function execute()
   {
       //Edit it according to your requirement
       $this->_logger->debug('Cron run successfully');
       return $this;
   }
}

In magento 2 I have checkCronJobs function in namespace Company\Module\Model class;

Is there any other way to call function in cron or we need to pass checkCronJobs with all dependencies in Runcronjobs.php file as we do normally in M2.


texts: Configurable Product Show Out of Stock Simple Product in Dropdown

texts:
I am currently using Magento 1.8.1.0 and I am having some inventory issues with Configurable Products. I am trying to show Out of Stock Simple Products in the Dropdown but let the Customer know it is out of stock when selected. As far as I can tell, the only time a customer is notified it's backordered is after they place the order, which they are then notified in the confirmation email.

I have attached a screenshot of the Configurable Product in question.

There is another Simple Product associated with this Configurable Product but it's currently set to Out of Stock in Inventory, so it is not displayed.

What I am trying accomplish is when the highlighted product (it has a negative inventory already) is selected, I want it to show the "Out of Stock" text by the price like it does for Simple Products that are Out of Stock. (2nd Screenshot in green box)

I have the inventory settings set for the Simple Products within the Configurable Product:

If this product is set to Out of Stock, it is not displayed as an option. I want our customers to know we manufacture this product but we do not have any in stock at the moment.

If I was able to add (Out of Stock) after the Product Name in the Dropdown, that would be sufficient as well.

A Simple Product acts in a very similar way to the Configurable Product, when the inventory is set the same as the Simple Products within a Configurable Product (3rd screenshot). Meaning no Out of Stock text is displayed:

Once I headed to the checkout after adding a Configurable Product and Simple Product to the cart (both with negative inventories and backorders available below 0), I noticed a red asterisk below the Product Name? Is this supposed to have some text stating the product is going to be backordered? If that's the case, I would not need any other changes. I will investigate and see what is supposed to be there in the mean time.

Any of the 3 possible solutions will be more than adequate. Thank you in advance!


texts:
I'm working on Inventory Management Module.I want to add three new columns in grid.I was able to add new columns.That's fine.But now i am not able to populate data in respective columns.Please refer below screen :

I have added three columns color,shelf locations and combinations.I created these attributes and imported data.Please help me out guys to solve this.


texts: How can I add a Menu item in Magento 2 default Luma Theme ?


texts: Error: Item (Magento\Framework\DataObject) with the same ID "50" already exists

texts:
After running catalog:images:resize I got the following error:

php magento catalog:images:resize

  ...........Item (Magento\Framework\DataObject) with the same ID "50"
  already exists.

Does anybody have any idea what would the issue be and where to solve it?
Thanks.


texts: How to use different page layouts depends on base layout specified?

texts:
I have to use different page layouts (<page>) depends on base layout (<layout>) specified for a product.

For example,

  if I select a layout in product's 'Design' menu with the name
  '2columns-right', Magento 2 will render 'catalog_product_view.xml' for
  this layout.
  If I select 'onemore-layout', Magento 2 will render
  'catalog_product_view.xml' for this layout.

Currently I don't see relations between base layout (<layout>) and page layout (<page>).


texts: How to remove default options from sort order list?

texts: How can I remove default options from de sort by list? For example, see the image? Is it possible to remove Best Sellers from the list?


texts:
I checked my site and I have three H1 tags on my homepage.

Two are from my logo (Desktop and Mobile version) and the last one is the page title (the one I want to keep)

Which files do I have to modify to only have one H1 tag ?

I'm using Magento 2.1.1 and the Ultimo theme from Infortis.

Thank you and sorry for any mistakes.


texts: How to check product is exist in current website or not?

texts:
I just want to load the product if that is available on the current website else not on the custom page. here is my code which is not working product still loading if that not exists in the current store...

 public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager,\Magento\Catalog\Api\ProductRepositoryInterface $productRepository) {

        $this->storeManager = $storeManager;
        $this->productRepository = $productRepository;

    }
public function getProduct($product_id){
    try{
        return $this->productRepository->getById($product_id,false,$this->storeManager->getStore()->getId());
    }catch (\Exception $ex){
        $this->log($ex->getMessage());
    }
}


texts: All the possible ways to export/import categories with ids

texts:
I am transferring my store to a fresh installation and I need to know, what are the possible ways to export all my existing categories with their respective Ids, description, title etc and import it to my new installation. I have tried 1 or 2 extension but they doesn't seem to work properly. My current store is running on ver 1.7.02 and I am transferring it to ver 1.9.2.4

Need help.


texts:
I want to add css from module to my custom cms page like this:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Test_Customlayout::css/test.css" />
    </head>
    <body>
        <referenceContainer name="header.container">
          <block class="Magento\Cms\Block\Block" name="test" before="header">
              <arguments>
                  <argument name="block_id" xsi:type="string">23</argument>
              </arguments>
          </block>
        </referenceContainer>
        <referenceContainer name="page.top">
           <referenceBlock name="breadcrumbs" remove="true"/>
        </referenceContainer>
    </body>
</page>

but I've got an error like this while I'm trying to save the page:

Please correct the XML data and try again. XML declaration allowed only at the start of the document Line: 1


texts: Magento 2: I Want To Make Custom Products Tab On Home Page

texts:
I trying to make custom dynamic tab on home page but when do that I get an error Uncaught ReferenceError: tab is not defined at HTMLButtonElement.onclick ((index):1200)
Here is my code I don't know whats is the issue in my code:
<?php
    $categoryIds = [];
    $cateCount = count($block->categoryCollection());
    $i=1;
    $k=1;
?>

    <?php foreach ($block->categoryCollection() as $category): ?>
        <?php $categoryIds[] = $category->getData('entity_id'); ?>
            <button class="tablinks" onclick="openCity(event, <?= 'tab-'.$i; ?>)"><?= 'tab-'.$i; ?></button>
        <?php $i+=1; ?>
    <?php endforeach; ?>

<?php for($j=1;$j<=$cateCount;$j++):?>
    <div id="<?= 'tab-'.$j; ?>" class="tabcontent">
        <?php
            foreach ($block->productCollection($categoryIds) as $product):
                echo $product->getName();
            endforeach;
        ?>

<?php endfor; ?>

Js


texts: Contact Us Success Message Location Not Displaying Properly

texts:
I've asked this question once before with no results. However, this time I am using the Contact Us form in a CMS page. The URL redirects are all working properly. Everything is submitting properly as well. However, the success message is moving the page title down and displays on top of the success message, itself. At first, there were two success messages being displayed. I fixed that by removing

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
 from the contacts/form.phtml file. Now the success message only displays once, but my problem still persists.

I've tried to add this code to contacts/form.phtml:

<?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?>
<?php echo Mage::app()->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>

but this code just removes the success messages from showing completely.

I cannot find anywhere where the success message is being called for. I deleted it from the contacts/form.phtml file so I don't quite understand why it displays. I definitely want it to display, just not twice. Either way, I cannot find anywhere where to tell the success message to NOT move my page title down and over top of the success message.

This is VERY annoying and I have searched everywhere and cannot find a solution for this. Any help would be appreciated.


texts: Override Magento\Catalog\Block\Product\View Block failed

texts:
I need to override product view block but i got an error :

Here's my di.xml :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
   <preference for="Magento\Catalog\Block\Product\View" type="Magento\Module_Inject_Session\Block\Product\View"/>
</config>

Here's my new block :

And there is this error and I have no idea what to do about it :

anyone one know where i'm wrong? or what is the correct way to override this file?


texts: Magento 2 product import by PHP (Configurable,Categories)

texts: In Magento 1 I use http://avstudnitz.github.io/AvS_FastSimpleImport/ for product/category tree import.For Magento 2 I found https://github.com/firegento/FireGento_FastSimpleImport2 but seems like it does not provide configurable products and product/category linking. Maybe there is some tool like in M1 that extends Import/Export module functionality with PHP endpoints ?


texts: Problem with creating a session variable and using it in different module

texts:
I set a session variable through ajax request like in checkout page

Mage::getSingleton('customer/session')->setMyValue($value_from_post_data);

The above is set in a controller of a One Page Checkout module.

I have an event observer which observes checkout_onepage_controller_success_action here, when I access the session, I don't find my_value the session variable I created.

Note: The session ids are same. No change in them. After the session value is set, I printed the whole session data to confirm, the setMyValue created my_value in the session.

So the ajax request has done its job. It has set the variable But the observer picks up old session data. Why is this happening, give me a work around


texts: How to add city drop down in checkout page Magento 2?

texts: I want to add city drop down in checkout page instead of text field. Searching online couldn't get any solution. Also use this extension https://github.com/EaDesgin/Magento2-City-Dropdown ,but this module is not working properly. SO any other solution??


texts:
I am trying to setup a cart price rule but I can't seem to get it working. I am on Magento CE 2.1.5

I offer 4 price categories of products (elite, premium,standard etc...). If you buy two of the same category, you save $5.

I have it setup like this:

If ALL  of these conditions are TRUE :
-If total quantity  is  1  for a subselection of items in cart matching ALL  of these conditions:
-Price Category  contains  Standard

-If total quantity  is  1  for a subselection of items in cart matching ALL  of these conditions:
-Price Category  contains  Standard

When I go to the frontend, add two products that are standards, I see a discount of $10 (even though I set $5). Then when I go to checkout, and calculate shipping, the discount disappears.

The actions are as follows:

I cleared my cache and history, and reindexed.

Ideas? I also tried:

If ALL  of these conditions are TRUE :
-If total quantity  is  2  for a subselection of items in cart matching ALL  of these conditions:
--Price Category  contains  Premium

But that didn't work either :(


texts:
In one of my clients Magento setup 1.9.2 it is taking too long like
  5-7 minutes. I have enabled the code profiler to debug it.

  The result I am getting is like for example:

  Now my question is I believe that the time shown against Mage in Sr.2
  is 5.7526 seconds. but its really taking a total time around 7-8
  minutes. what should I look for to address t?e issue. Thanks.


texts:
I am trying to do a multi site setup in a magento instance running on lighttpd. I have followed this guide, including filling in the new secure- and unsecure-urls in system/configuration/web/. After doing the setup I have cleared the cache and restarted the webserver. For some reason I get redirected to the default website.

It has come to my attention that lighttpd does not support .htaccess files and I am not sure how I to check if htscanner is installed or if that helps at all in this specific case. Any pointers on this would be greatly appreciated! :)

Why am I being redirected to the default website? Is it because ligttpd does not set the environment variables I have specified in the .htaccess file using setenvif? If so, how can I fix that? Is there something else I am missing?


texts: Magento : Grouped Product with Configurable Product Mandatory to Add to Cart

texts:
I have a few grouped products, with more than one configurable products (with different colour as simple product) associated as sub products.

The problem is, because simple product (colour) in a configurable product is mandatory to select when add to cart. So when customer click on grouped product in my shop, he must also select at least one colour for each configurable product in order to proceed. but this is not what I want.

as shown in this image, a customer must select one of colour for both configurable products in order to buy this grouped product. How do I make it so customer only need to select just one configurable product and not all products.


texts: How to add custom price for bundle product while add to cart?

texts:
I have a bundle product that has been configured as dynamic price is "on". I tried to add custom price while add to cart like following code:
$customPrice = 500;
$item->setCustomPrice($customPrice);
$item->setOriginalCustomPrice($customPrice);
$item->getProduct()->setIsSuperMode(true);

Here $item is bundle product and configured dynamic price is "on".  The problem is while add to cart, the custom price is ignored if the dynamic price is "on". I found that custom price  ignoring core method. The method is from "vendor/magento/module-quote/Model/Quote/Item/AbstractItem.php"  class, "isChildrenCalculated()" method.
I created plugin for this method, after that the custom price added correctly. But after place the order in the admin sales_order_view page the child product prices displaying as zero.
I attached the screen shot of that. Help me to sort out from this issue.


texts: Notice: Undefined index: getQuantityAndStockStatus

texts:
On Bundle product detail page I am getting below error.

I tried:

- sudo rm -rf var/page_cache/* var/cache/* var/view_preprocessed/*  pub/static/frontend/* pub/static/adminhtml/* var/log/* generated/*
- magento setup:di:compile
- magento setup:upgrade
- magento indexer:reindex

However, issue is still not resolved.


texts:
can anybody help on this :

  (Psr\Log\InvalidArgumentException): Level "" is not defined, use one
  of: 100, 200, 250, 300, 400, 500, 550, 600
  vendor\monolog\monolog\src\Monolog\Logger.php(256):
  Monolog\Logger::getLevelName(NULL)
  lib\internal\Magento\Framework\Logger\Monolog.php(24):
  Monolog\Logger->addRecord(NULL, 'Tagalys Request...', Array)

This is how i have used logger

protected $logger;
public function __construct(
\Psr\Log\LoggerInterface $logger,
 ) {
     $this->logger = $logger;
   }

public function xyz(){
$this->logger->log(null, 'Tagalys Request Object: '.json_encode($payload));
}

I am not getting any log files


texts:
How can I reset to zero the dashboard stats without deleting orders.

truncate table sales_flat_order;

truncate table sales_order_tax;
truncate table downloadable_link_purchased;

delete from eav_entity_store WHERE entity_type_id in (
select entity_type_id FROM eav_entity_type WHERE entity_type_code in ('order', 'invoice', 'creditmemo', 'shipment')
);

Thank you,
Elvis


texts:
I have modified the header in my Magento2 site and it appears skewed to the right. I have checked the CSS of the div and the subsequent elements - logo, search and cart and cannot find a fix. Attached is a screen shot and the living site can be seen here: shorturl.at/nFJMT
What am I missing?


texts: Magento 1.9.3.3 - How do you return a JSON array from a controller to ajax

texts:
I have a ajax call to a controller (suburbSearchAction) which retrieves a list of suburbs based suburb text received from the user

Ajax call

inputSuburbData = jQuery(inputSuburb).val().trim();

        jQuery.ajax({
            type: 'POST',
            url: '/service/Index/suburbsearch',
            data: {inputSuburbData:inputSuburbData},
            complete: function(responseData) {

                console.log(responseData);

            },
            error:function(response){

                console.log('Response Error');
                console.dir(response);
            }
        });

Controller Code

<?php

class Vendor_Service_IndexController extends Mage_Core_Controller_Front_Action
{
    public function suburbSearchAction()
    {

        /* Get Suburb text from POST Request */
        $suburbNameQuery = $this->getRequest()->getParam('inputSuburbData');

        /* Retrieve Service Model at: Vendor/Service/Model/Shipping/Carrier/Ram.php */
        $model = Mage::getModel('vendor/shipping_carrier_ram');
        Mage::register('suburb_query', $suburbNameQuery);
        $model->_getSuburbs();
        $suburbResultArray = Mage::registry('suburb_resultset');

        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($suburbResultArray));
    }
}

I can confirm the following:

The ajax call calls the controller suburbSearchAction()
The varibale in the controller $suburbResultArray has an array of suburbs. so everything is working up till here

My problem is i am unable get the response json to return back to the JavaScript file on completion of the ajax call. it simply returns nothing. The responseData object has no Json array in it.

So basically i want to return json from my controller to my javascript file.

Am i missing anything?

Thanks


texts: Get all options of custom attribute in magento 2 .phtml file

texts:
I want to get all options of my custom attribute in frontend customer register.phtml and edit.phtml file.

In CE


texts: How to add a CMS Block via XML layout update in Magento 2?

texts:
In order to create custom sidebar menus for my CMS pages in Magento 1, I used to be able to create a static block, and then use a widget to place it on all CMS pages that had a 2 column layout with left bar. That option is not available in Magento 2.

So, for Magento 2, I created a block called "guidenav", and I want it to appear on certain CMS pages, and for those CMS pages I can use this code in Layout Update XML:

<referenceContainer name="sidebar.additional">
    <block class="Magento\Cms\Block\Block" name="guidenav">
        <arguments>
            <argument name="block_id" xsi:type="string">guidenav</argument>
        </arguments>
    </block>
</referenceContainer>

The block isn't showing up. Any ideas?


texts: how to read nth number of row in csv magento

texts:
yesterday i was working read data from csv in magento. I know that i can read date from csv in magento using this function.

Varien_File_Csv()

but what i want to know is how to read a fix number of row? i want to read it in multiple partbecause file have more than 100k rows. everytime i have to search a data in all rows. so i thought instead of read all data at once i should do it in part. i.e what everdata i am searching if its available in first 1k row so why i read it next. so can some 1 tell me how to read data from 1-1000 rows or 1001-2000 row ?


texts: magento 1.9+ page shows 404 not found after 1.1 minutes

texts:
I want to disable the 1.1 minutes limit for the page execution. I have a script that takes around 20 minutes to execute and need access from a url, but before the execution of the script is finished magento shows "WHOOPS, OUR BAD..." 404 error page.
How can I remove the one 1 minute limit?