texts:
I want to add timer to cart.

If item is added to cart it will remain in cart only for specific time say 15 min also product quantity will reduce as per quantity added in cart.

Customer should begin payment process within this time else automatically item remove from cart and product quantity will as it is before.


texts: customerRepositoryInterface->save does not update attribute "is_active"

texts:
I'm trying to update "is_active" attribute but nothing happens in the database. I don't get an error message either. What am I doing wrong?

public function changeStatus($statusData)
{
    $customer= $this->customerRepositoryInterface->getById($statusData['id']);
    $customer->setData('is_active', 0);
    }
    try{
        $this->customerRepositoryInterface->save($customer);
    } catch (\Exception $e ){
        throw new \Exception($e->getMessage());
    }
}


texts: add product programmatically magento 2: Undefined property: stdClass::$reference

texts:
I went to the backend of magento I added a reference attribute for product,
then I executed the script Programmatically to add product I put:

$_product->setName($product_data->_source->name);
$_product->setTypeId('simple');
$_product->setSku('sku'.$item);
$_product->setreference($product_data->_source->reference);
...
$_product->save();

but an error is displayed as following,

 please how to add an attribute and access it with set and thanks in advance


texts: Getting "url key for specified store already exists" error in magento2

texts:
I have installed magento2.1 and it was working properly with multi-store.

When I have disabled some categories from a "sub" store, and try to add any product (already assigned to "sub" store) to that category (which is edited in "sub" store) system returns error url key for specified store already exists.

If I removed "sub" store from "product in website" and try to assign that category again it saved successfully.

That's mean it is the issue with categories which has different value of any attribute in multi-store view.

I found so many post regarding this, but unable to fix this issue.

How to solve this issue in magento2?


texts: How to remove Add To Compare links in magento 2.2.0?

texts: I want to remove 'Add To compare' links all over the website. The Add To Compare  module is irrelevant for me. I am using Magento 2.2.0 version.


texts: Magento Cache Backend Performance memcached local read, local write, global invalidate

texts:
in a setup with multiple magento frontends i discovered that using a shared memcached as a cache backend over the network slows down the frontends (probably because of network latency) in comparison to a memcached which runs on each frontend and is accessed via socket.

my idea was thus to write a cache backend which stores and reads cache entries locally on each frontend. so far this is simple, only invalidation is the problem, if an action occurs where one frontend invalidates a cache entry the other frontends would not notice that.

so to invalidate the other frontends i send all remove and flush commands to all other nodes using curl and a php-script to issue the same command locally.

an example:

node1: get X : false
node1: store X

node2: get X : false
node2: store X

node1: remove X : true

now node2 remains to have the old version of X

now with the "distributed command":

node1: get X : false
node1: store X

node2: get X : false
node2: store X

node1: remove X : true
node1: --> node2: remove X : true

now both nodes would store a fresh version of X next time it is needed

My Question:

is this insane or does it make sense? is there something out there which does that already? am i missing a point about memcached using multiple servers? should the network latency not be a bottleneck?
to clarify: by reading locally from memcached i was able to speed up a category view by 100ms (currently it is at around 300) so imho this is worth the trouble.


texts: Retrieve Entity Id from REST API using Order ID

texts: Working with the REST API on Magento 2.1.9 I notice that the Entity ID is needed for the /V1/orders/ endpoints. How can entity_id be retrieved via the API when I only know increment_id?


texts:
We are using 1.9.1.0 on wamp 2.5.
I have just moved the database and all the files from our live website. The only problem now is that while some product images are loading most are not loading. Any help is really welcome.


texts: magento 2: how to show selected radio box option based on database value?

texts:
I want to add the radio boxes in magento admin panel. Which will also show the selected radio box as per the value stored in the database.

I have the column in database which stores the values from the front end form like Male and Female.

Now i want to add the radio box in admin panel, which will show the radio option selected Male or Female. Based on value stored in database.


texts: Display grid in custom admin module only when i enter id and click search button in magento 1.9

texts: i have created a custom module in admin panel which will display data from the DB it is working. but i want to display that grid only after you enter a id in the search box. i have not created the search box. can some one help me with search box creation on top a grid?


texts:
I am confused about this method declaration. In this class Wrapper.php (Mage/Page/Block/Html/) under _toHtml() method, there is a line coded as below.

$id = $this->hasElementId() ? sprintf(' id="%s"', $this->getElementId()) : '';

Which class defined this method hasElementId()? I tried to search current class and all parent class, none of them are declared this method.

Please enlighten me on this.


texts:
After login, no personal prices are showing.
Site is testshop.etkserver.nl
Also, the price in the product tile is gone. Not sure if those two issues are related.
I have been working on other things, but I cannot think of anything I did that might have caused the prices to disappear.

This is a screenshots of a part of a page with product tiles before login:

And this is after login:

The listing on the product detailpage does not show discounted prices either, see:

It used to work.
I hope someone can tell me where to look. Or what to do.
Thanks.


texts:
I have a Mage_Sales_Model_Order_Shipment_Item object and I'm able to load a product model using the shipment item's sku (if I can get this attribute by just using the shipment item, all the better).

The loaded product model doesn't seem to contain the size attribute. When I var_dump($prod->getData()) or var_dump($prod) there is nothing about its size. The attribute's code is size. It is set on the product I am loading, it is global, Dropdown type, not unique, required. How can I get a specific product attribute, in this case "size", from a model loaded by sku?

$prod = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
echo $prod->getSize();
echo $prod->getData('size');

Also, I would expect this to return a value of 57. It is a dropdown type attribute. How can I get the value for this option_id? For example, I'd like to get the value "small", not 57. Btw, I see these values set for this particular sku in the database.

I've tried this solution also

$pc = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToFilter('size', array('notnull' => 'true'))
    ->addAttributeToFilter('size', array('neq' => ''))
    //->addAttributeToFilter('sku', array('eq' => '100-0055-BLK-S'))
    ->addAttributeToSelect('size');
//$p = $pc->getFirstItem();
$usedAtts = array_unique($pc->getColumnValues('size'));
$attModel = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'size');
$usedAtts = $attModel->getSource()->getOptionText(implode(',', $usedAtts));
var_dump($usedAtts);

But $usedAtts is false.

Update: I tried the method in my first example, loading the product with sku, on a fresh install and it worked. I setup the size attribute just the same, except the new install has it in the 'default' attribute set, where the prior is a custom. I will try to look into those differences.. but in the meantime, anyone have an idea of why I can't get it in my prior install? I setup the products the same. In the prior, I can get the color attribute.. not sure why I can't get size.


texts: Magento 2 : Create cms block store vise with same identifier

texts:
I want to create CMS block with same identifier. For ex.  Testing is my identifier. But, content of testing is different in German store view and Russia store view.

How to create store vise CMS block with same identifier ?

Please help me.

Any help would be appreciated.


texts: How to remove custom product attributes on module disable?

texts:
I added 2 custom product attributes with the help of setup/InstallSchema.php in my Magento 2 custom module. It's working fine.
But, I can't remove these Product attributes on module disable from the site admin module manager section.
I write code for remove attributes in setup/Uninstall.php file like the following

public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context )
    {
        $setup->startSetup();
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

        $eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'product_attr1');
        $eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'product_attr2');

        $setup->endSetup();

    }

But this is not working when I disable the plugin from admin.

Is any event running just before uninstall started? or any other way to hide the attribute fields when uninstalling the plugin?


texts: Product last modified date & who modified it

texts: I would like to know is there a way where I could get last modified date & who modified the product in magento backend?


texts:
I created an extension for Magento on Magento 2 1.0.0 beta. Now I'm trying to get this extension working for Magento 2 RC, but I can't figure it out. What I have is a very simple extension that creates a block show I can show all my categories in the sidebar (regardless of what category I'm viewing). The extension did work perfect on Magento 1.0.0 beta, but now gives this error: Invalid block type: \SL\Sidebar\Block\Sidebar. The extension is installed correctly. This is the code of my block:

namespace SL\Sidebar\Block;

use Magento\Framework\View\Element\Template;

class Sidebar extends Template {

    /**
     * @var \Magento\Catalog\Helper\Category
     */
    protected $_categoryHelper;

    /**
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry;

    /**
     * @var \Magento\Catalog\Model\Indexer\Category\Flat\State
     */
    protected $categoryFlatConfig;

    /**
     * @param Template\Context                                   $context
     * @param \Magento\Catalog\Helper\Category                   $categoryHelper
     * @param \Magento\Framework\Registry                        $registry
     * @param \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Helper\Category $categoryHelper,
        \Magento\Framework\Registry $registry,
        \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState,
        $data = []
    ) {
        $this->_categoryHelper = $categoryHelper;
        $this->_coreRegistry = $registry;
        $this->categoryFlatConfig = $categoryFlatState;

        parent::__construct($context, $data);
    }

    /**
     * Get all categories
     *
     * @return array|\Magento\Catalog\Model\Resource\Category\Collection|\Magento\Framework\Data\Tree\Node\Collection
     */
    public function getCategories()
    {
        return $this->_categoryHelper->getStoreCategories();
    }
}

Then in my theme I load the block like this:

<block class="SL\Sidebar\Block\Sidebar" name="category-sidebar" template="Magento_Theme::html/sidebar.phtml" />

Registration.php:

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'SL_Sidebar',
    __DIR__
);

The extension did work perfect on Magento 1.0.0 beta. Does anyone know the problem here?


texts: Cart2Quote Quotations error: Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed

texts:
I got an error after installing cart2Quote free
(Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
i am using magento 2.2.7
Please help!


texts: How to calculate catalog taxes based on estimated address for guests?

texts:
We display product prices including tax in our catalog and our "Default Tax Destination Calculation" is none.
Most of our customers are guests (so not registered) and based on their IP we guess their destination country and trigger Mage_Checkout_CartController::estimatePostAction() with it in case there isn't a country already set manually via the "Get a Quote" button on the cart page (which triggers the same function but with the country and address the guest entered manually in the "Estimate shipping and tax" form).

This approach causes the Cart to show the correct taxes (even on the guest's first visit when the IP guess was correct). However it doesn't affect the catalog prices. Those are always shown with including 0% tax for the guest. That also applies when the guest manually triggered a quote and even when he completed an order.

Now the question is, how can we achieve that the guests directly see the catalog prices including the tax based on their estimated country (note that we are based in Europe so all tax rules are only country specific and state or postal code is irrelevant) just like registered users always see the correct taxes based on their default registered address directly in the catalog?
Any approach via configuration or programmatically is welcome!


texts: show text in item description for currently selected attribute

texts:
Magento 1.9.3

I have a custom piece of code in the description.phtml page for a product.  This description auto populates if the item has attributes associated with it.

This works well for my purpose but to refine it further I would like it to show instead of the products attribute show the currently selected attribute from the drop downs on the product page.

ie. if a custom changes the size of a product, in the description instead of showing (default size for product eg: Size L) it would show the currently selected size( eg. size M)

I realise this would require some sort of ajax call to load this.. or not?  Im not that advanced yet in coding.

thought it worth asking the question as it would make a great addition to my product pages.

here is the current code I am using to show text.

<?php if ($_product->getData("finger_size") == true){
echo " this ring comes in size ",$_product->getData("finger_size"),"


texts: Magento 2 custom config form in admin panel is empty

texts:
I followed this tutorial https://www.magestore.com/magento-2-tutorial/how-to-create-an-admin-form-look-like-a-configuration-page-magento-2-configuration-p3/#3createa_layout_file_with_url_path.

It shows how to create a setup form for custom modules.
However for some reasons it's showing me everything empty, except for the name of the module and Store View.

This is my system.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="sift" translate="label" sortOrder="10">
            Sift
        </tab>

            <class>separator-top</class>
            Hello World
            <tab>Sift</tab>
            <resource>Vendor_Module::menu_item</resource>
            <group id="sift" >
                General Configuration
                <field id="debug_enable" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Enable Debug
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

                </field>
            </group>

    </system>
</config>

This is my 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="Vendor_Module::menu">
                    <resource id="Vendor_Module::menu_item" title="Configuration" sortOrder="80" />
                </resource>
            </resource>
        </resources>
    </acl>
</config>

and finally config.xml

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

            <sift>
        <debug_enable>1</debug_enable>
            </sift>

    </default>
</config>

Please help.
Thanks!


texts: Running Magento 1.9.2.2 - Customers cannot login - if reset password email sent, frame at link is blank

texts:
I am running Magento CE 1.9.2.2, and today a customer notified us that they cannot login, or retrieve their password.

To test, I attempted to login with a customer account, it just refreshes the login page, and shows the same login/password space.

If I attempt to reset a password, it sends the email, but when you click on the link in the email the frame is blank that would load the reset form.

I have also edited app/code/core/Mage/Customer/controllers/AccountController.php and uncommented the  Mage::logException($e); call and then checked the /var/log/exception.log file and it is blank.

Any advice would be appreciated.


texts: Only update one attribute instead of whole table

texts:
<?php
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->updateItem($itemID, array( 'qty' => $qty));
$quote->save();
?>

The above updates pricing when i only want to update qty. Code is in frontend. Base price is set to 0 when I call the above script.

I am updating the sales_quote_item table


texts: Magento 2: Layered navigation sidebar filter search query customization

texts:
I want to customize the query  like ?product_type=64  I want to add more attribute in query .
I just actually want filter works only on configurable pre-select value not all products which have that attribute.

Is there any way to do like that?


texts: Disable Status problem in magento admin grid

texts:
below code is _prepareMassaction() in grid.php

protected function _prepareMassaction()
    {
         $this->setMassactionIdField('slideshow_id');
         $this->getMassactionBlock()->setFormFieldName('slideshow');

        $this->getMassactionBlock()->addItem('delete', array(
             'label'    => Mage::helper('slideshow')->__('Delete'),
             'url'      => $this->getUrl('*/*/massDelete'),

        ));

     $statuses = Mage::getSingleton('slideshow/status')->getOptionArray();

    //print_r($statuses); die;

        array_unshift($statuses, array('label'=>'', 'value'=>''));
        $this->getMassactionBlock()->addItem('status', array(
             'label'=> Mage::helper('slideshow')->__('Change status'),
             'url'  => $this->getUrl('*/*/massStatus', array('_current'=>true)),
             'additional' => array(
                    'visibility' => array(
                         'name' => 'status',
                         'type' => 'select',
                         'class' => 'required-entry',
                         'label' => Mage::helper('slideshow')->__('Status'),
                         'values' => $statuses
        )
        )
        ));
        return $this;
    }

Below code in massStatusAction() in my controller.

public function massStatusAction()
    {
        $ids = $this->getRequest()->getParam('slideshow');
        //print_r($ids); die;
        if(!is_array($ids)) {
            Mage::getSingleton('adminhtml/session')->addError($this->__('Please select checkbox'));
        } else {
            try {
                foreach ($ids as $id) {

                    //print_r($id); die;
                   Mage::getSingleton('slideshow/slideshow')
                        ->load($id)
                        ->setStatus($this->getRequest()->getParam('status'))
                        ->setIsMassupdate(true)
                        ->save();
                }
                $this->_getSession()->addSuccess(
                    $this->__('Total of %d record(s) were successfully updated', count($ids))
                );
            } catch (Exception $e) {
                $this->_getSession()->addError($e->getMessage());
            }
        }
        $this->_redirect('*/*/index');
    }

When i changes action from disable to enable it successfully changes. but again when i change status from enable to disable. it not changes my status.


texts: Delete / Unset existing custom options on product

texts:
I have created an observer on catalog_product_save_before in order to add custom options to a product.

What i don't manage to achieve is clearing out existing custom options beforehand.

Here is my code:

       $product = $observer->getProduct();

       $option1 = array (
            'is_delete' => 0,
            'title' => 'extra Option for that product',
            'type' => 'drop_down',
            'is_require' => 1,
            'sort_order' => 1,
            'values' => array (
                0 => array (
                    'value_id' => '3',
                    'title' => 'Yes',
                    'price' => 10.00,
                    'price_type' => 'fixed',
                    'sku' => NULL,
                    'sort_order' => 1,
                ),
                1 => array (
                    'value_id' => 3,
                    'title' => 'No',
                    'price' => 0.00,
                    'price_type' => 'fixed',
                    'sku' => NULL,
                    'sort_order' => 2,
                ),
            ),
        );

    $product->setCanSaveCustomOptions(true);
    $product->getOptionInstance();
    /* @var $product Mage_Catalog_Model_Product_Option */
    $product->getOptionInstance()->unsetOptions();
    $product->getOptionInstance()->addOption($option1);
    $product->setHasOptions(true);

this does not seem to have any effect:

     $product->getOptionInstance()->unsetOptions();


texts: Magento 2.3: How to configure fields to be used in Elasticsearch?

texts:
I need to configure the list of fields that are searched when you search in Magento. I am using Elasticsearch 7 as the engine. I need to stop it from searching by SKU and manufacturer, and add in a custom attribute to search by - either by changing what is indexed or changing what fields are searched.
I'm digging through all of the module-elasticsearch code, but it's hard to find what I would need to override.


texts: Where should i put my function if i need it only in one Template?

texts:
I got a template called dashboard.phtml and i want to add a function there.
I thought it was a bad practice to write it directly in the template it self so where should i put it?

The class for this one is the Mage_Customer_Block_Account_Dashboard.

I thought about helpers but in a other Question they say, that helpers never should be used.

The function is called 5 times in the template.


texts:
I was added new atrribute with text, and want to see it like new tab, just after description. Was try many codes, but still nothing. Magento 1.9.1
Below my local.xml

<block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml">
    <action method="addTab" translate="title" module="catalog">
        <alias>description</alias>
        <title>More Information</title>
        <block>catalog/product_view_description</block>
        <template>catalog/product/view/description.phtml</template>
    </action>

    <!-- sklad tab -->
    <action method="addTab" translate="title" module="catalog">
        <alias>sklad</alias>
        <title>Skład Produktu</title>
        <block>catalog/product_view_attributes</block>
        <template>catalog/product/view/sklad.phtml</template>
    </action>
    <!-- end sklad -->

    <action method="addTab" translate="title" module="catalog">
        <alias>upsell_products</alias>
        <title>We Also Recommend</title>
        <block>catalog/product_list_upsell</block>
        <template>catalog/product/list/upsell.phtml</template>
    </action>
    <action method="addTab" translate="title" module="catalog">
        <alias>tabreviews</alias>
        <title>Reviews</title>
        <block>review/product_view_list</block>
        <template>review/product/view/list.phtml</template>
    </action>
    <action method="addTab" translate="title" module="tag">
        <alias>tags</alias>
        <title>Tags</title>
        <block>tag/product_list</block>
        <template>tag/list.phtml</template>
    </action>
    <action method="addTab" translate="title" module="catalog">
        <alias>additional</alias>
        <title>Additional Information</title>
        <block>catalog/product_view_attributes</block>
        <template>catalog/product/view/attributes.phtml</template>
    </action>

    <!-- Add custom tabs -->
    <block type="cms/block" name="block_product_tab1">
        <action method="setBlockId">
            <block_id>block_product_tab1</block_id>
        </action>
    </block>
    <block type="cms/block" name="block_product_tab2">
        <action method="setBlockId">
            <block_id>block_product_tab2</block_id>
        </action>
    </block>
</block>
<!-- end: Add tabs -->

And my sklad.phtml

<?php
$_prodID = Mage::registry('current_product')->getId();
$_product = Mage::getModel('catalog/product')->load($_prodID );
echo $_product->getProduct_sklad();
?>

Can somebody help me? please.
B.R
Zydol


texts: It all return default value, which is "No", when I want to get dropdown value

texts:
I add a new attribute at backend called eol to identify the product is end of life or not. Then, there are several .phtml files should be modified. Now, I modified a file here:

app\design\frontend\enterprise\arctic_enterprise\template\catalog\product\view.phtml

and it works well. It is used to display end of life sign in the product description page.

Then I want to modify a file here:

app\design\frontend\enterprise\arctic_enterprise\template\catalog\product\list.phtml

But it doesn't work. It is used to display end of life sign in the product sub-category.

Here is the code which is really easy:

$attribute = $_product->getResource()->getAttribute('eol')
                 ->getFrontend()->getValue($_product);
print_r($attribute);

if ($attribute == 'Yes') {
    $_isEOL = true;
} else {
    $_isEOL = false;
}

The idea is to fetch the value of attribute, which is eol, when the page is loading. I used print_r($attribute); to display the value of $attribute, they are all return default value, which is no.

Thanks for your answer!


texts: Enable apache served files compression in Magento

texts:
I have enabled apache served files compression in the .htaccess of my website. However when I check with Google PageSpeed if it's working or not I get "Enable Compression" as a high priority. Also the website doesn't feel faster.

I have enabled compression in the .htaccess:

php_flag zlib.output_compression on

And I have uncommented the lines:

# Insert filter on all content
SetOutputFilter DEFLATE

# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

Am I doing this right? Why isn't the Website loading faster?


texts: How to get CustomerId in API in magento 2? and how magento gets customerId for the same?

texts:
Magento didn't load the customer session in API as used in web session based authentications.

and i am aware about the API

<magento.host>/rest/V1/customers/me

  My question is, how do I make that call with PHP, so my code
  captures the customer ID and can use it.

  How do I make a call to that URL programmatically and capture the
  User ID into a PHP variable?

  How magento make calls in-between for the APIs ?


texts: load product in perticular category in magento

texts:
I am creating navigation for my store. I am new to magento. I am having problem to load product under that category. It is possible for me to print all product under all categories but I dont know how to load products under its specific category.

This is my code

<?php $_menu = $this->renderCategoriesMenuHtml($this->getSelectedCategoryId(), 0, 'level-top') ?>
<?php
if ($this->getTitle() != '') {
    $title = $this->getTitle();
} else {
    $title = 'Categories';
}
?>
<?php
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
?>
<?php if ($_menu): ?>

<?php echo $this->__($title) ?>

                <?php $children = Mage::getModel('catalog/category')->getCategories(2);?>

                    <?php foreach($children as $category){ ?>

                    <a href="<?php echo $category->getUrlPath(); ?>"><?php echo $category->getName();?>
                    <?php $category = Mage::getModel('catalog/product')->load($category->getId()); //Pass category ID here.
                          $productCollection = $category->getProductCollection();?>

                        <?php foreach($productCollection as $product){ ?>

<?php echo $product->getName(); ?>

                        <?php }?>

                    <?php } ?>

<?php else: ?>
    <?php if (Mage::helper('mpanel')->acceptToUsePanel()): ?>

<?php echo $this->__($title) ?>

<?php echo $this->__('Have no categories.'); ?>

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

EDIT

                <?php $children = Mage::getModel('catalog/category')->getCategories(2);?>

                    <?php foreach($children as $category){ ?>

                    <a href="<?php echo $category->getUrlPath(); ?>"><?php echo $category->getName();?>
                    <?php $categoryId = $category->getId(); ?>
                    <?php $category = Mage::getModel('catalog/category')->load($category_id);
                            $products = Mage::getModel('catalog/product')
                            ->getCollection()
                            ->addAttributeToSelect('*')
                            ->addCategoryFilter($category)
                            ->load();
                    ?>

                        <?php foreach($products as $product){ ?>

<?php echo $product->getName(); ?>

                        <?php }?>

                    <?php } ?>


texts: Magento 2 Tax Calculation based on Row Total

texts:
I have my tax set to calculate tax on total however am getting slight miss matches in edge cases with Sage Accounts 50. From what i can tell this calculates on row total. So have changed this and flushed my cache however the issue still occurs.

This is how i believe each method to work and how i think Sage is working:

Row Calculation

Units   Item            Row Ex Vat     Row Total
4       Example Item    57.56          69.072 (69.07)
4       Example Item    57.56          69.072 (69.07)
4       Example Item    57.56          69.072 (69.07)
Total Ex Vat   172.68
Total Inc Vat  207.21

So for each row you calculate the Vat on the row total. So (14.39 x 4) x 1.2 = 69.072 and then round to nearest pound giving 69.07 for each row. This gives the same total of 207.21 that Sage 50 Accounts gives and what i want Magento 2 to calculate like.

Unit Calculation

Units   Item            Ex Vat     Inc Vat         Row Total
4       Example Item    14.39      17.268 (17.27)  69.08
4       Example Item    14.39      17.268 (17.27)  69.08
4       Example Item    14.39      17.268 (17.27)  69.08
Total Ex Vat   172.68
Total Inc Vat  207.24

This is how i feel unit calculation works where the tax calculation is based on units. So 14.39 x 1.2 = 17.268 and then rounded to nearest penny giving 17.27 for each unit total. This then gives a total of 207.24 for all units.

Total Calculation

Units   Item            Ex Vat     Inc Vat         Row Total
4       Example Item    14.39      17.268          69.072
4       Example Item    14.39      17.268          69.072
4       Example Item    14.39      17.268          69.072
Total Ex Vat   172.68
Total Inc Vat  207.216 (207.22)

For total calculation i feel there should be no rounding until all the totals are calculated. This works like so i believe. (14.39 x 12) x 1.2 giving 207.216 which then rounds to nearest penny so 207.22. I feel like Magento 2 always works like this for me however, no matter how i set in admin.

Actual Question

Can anyone suggest what i may have got wrong anywhere or how can i set Magento to work on row totals as i have described. I have set within Stores > Configuration > Sales > Tax > Tax Calculation Method Based On > Row Total and flushed the configuration tax however my total in this example always shows as 207.22?

Update

Flushing all my caches seems to have fixed my issue here. I was previously just flushing configuration so may be one of the others needed flushing too.


texts: Magento2: Change order status to processing if any specific coupon code has been applied

texts: How can I change the order status to "Processing" automatically if any specific coupon code has been applied during place order in Magento 2?


texts: What actually is being reindexed when we don't enable Flat Category and Flat Products?

texts:
In Magento we can choose not to have Flat Category and Flat Products.

My question is simply what actually is being reindexed by the Category Indexer / Product Attributes Indexer if we don't enable Flat Category and Flat Products? Since we're not flattening / denormalizing anything.


texts: Hiding Magento Category Images On Page 2

texts: How do you go about hiding category images on page 2 & beyond? In other words, just have the image load on page 1 & if there's more than 1 page of products...have the image hidden.


texts: I can't add new customer in the Magento 2.4 frontend

texts:
I am having the following problem: I cannot add new clients from the store frontend (Magento 2.4.) I have already verified the existence of $ block-> getBlockHtml ('formkey') in the form, I have already changed localhost to 127.0.0.1 (I am testing locally) and when I submit the form nothing happens, it does not show any error or create adds the new client.
In the backend I can add new customer without any problems
I have cleaned, flushed the chache and reindexed.
Please does anyone have any ideas about what I'm missing? Thanks in advance


texts: Why is out of stock product having add to cart button in grids of sample data in magento 2.3.0 vanilla instance?

texts:
For reference, Please install magento 2.3.0 instance with sample data and observe LifeLong Fitness IV product.

On product detail page, it's showing Out of Stock and it makes sense to me as quantity is 0 and it's not even using Advanced Inventory options as well for stock management.

How come it's showing Add to Cart button on home page/grid. when it is out of stock.

Also the Backorders options is set as No Backorders.

According to my research, I have figured out that isSalable() is returning true for this product because of the function getStatusExpression() in /var/www/html/magento2/vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php.

protected function getStatusExpression(AdapterInterface $connection, $isAggregate = false)
    {
        $isInStockExpression = $isAggregate ? 'MAX(cisi.is_in_stock)' : 'cisi.is_in_stock';
        if ($this->_isManageStock()) {
            $statusExpr = $connection->getCheckSql(
                'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0',
                1,
                $isInStockExpression
            );
        } else {
            $statusExpr = $connection->getCheckSql(
                'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1',
                $isInStockExpression,
                1
            );
        }
        return $statusExpr;
    }

Basically what it does is that whenever indexing is performed, it sets stock_status of product by default as 1 for products not using Advanced inventory options.

The reason why we see Add to Cart for the mentioned product is because it sets stock_status as 1 and makes it saleable product even though it's quantity is 0.

Please check this tables for reference

  cataloginventory_stock_item

&

  cataloginventory_stock_status

If you set stock_staus manually in cataloginventory_stock_status as 0, it will not show Add to Cart button.

What I want is that I don't want to show Add to Cart button if the product is out of stock.

Please let me know if there is any configuration for it that I'm missing or it requires any customization on core files or if it's a magento bug.


texts:
i try to calculate tax for export.Every price in magento admin had already inserted with tax include. So the only sollution i can think is to calculate it at success page.

With tax 24% i try to calculate it by

<?php $tax = ($totalprice->getSubtotal() /1.24)*0.24; ?>

is it a syntax error?

Any other way to auto calculate magento the prices and tax?


texts: URL key for specified store already exists on Category edit in Magento in Magento 2.1.6

texts:
I working on a project on which I get the error

  URL key for the specified store already exists

While editing category on store 2. I get this error only on store 2 Arabic first category and also in its subcategories.

I have surfed a lot. According to github, it is bug of Magento. However, I tried by truncating catalog_category_product_index and catalog_category_product.
It works, but I cannot truncate it because of a large number of products in categories.
Is there any way to resolve this error?

https://github.com/magento/magento2/issues/6671

https://github.com/magento/magento2/issues/7298

https://github.com/magento/magento2/issues/3268


texts:
I am working with the following code, which displays all products from all orders for the logged in customer. Problem is its duplicating the products I only want 1 of each product to display.

When I do vardump($uniuqProductSkus); I get the following printed out under each product

array(1) { [0]=> string(2) "96" }

array(1) { [0]=> string(4) "9902" }

array(2) { [0]=> string(4) "9902" [1]=> string(2) "96" }

I believe its like this because I ordered "96" and "9902" in individual orders and then I ordered "96" and "9902" together in one order

I've tried array_unique in a couple of different places but never get the right results

<?php
if (Mage::getSingleton('customer/session')->isLoggedIn()) {

/* Get the customer data */
$customer       = Mage::getSingleton('customer/session')->getCustomer();
/* Get the customer's email address */
$customer_email = $customer->getEmail();

}

$collection = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_email', array(
'like' => $customer_email
));

foreach ($collection as $order) {
//do something
$order_id = $order->getId();

$order = Mage::getModel("sales/order")->load($order_id); //load order by order id

$ordered_items = $order->getAllItems();

// -----------------Initialized an empty array to store unique products SKUS
$uniuqProductSkus = array();
foreach ($ordered_items as $item) {
 //item detail
    //Check if product already exists  in uniuqProductSkus array, means it is duplicate, do not process, continue
    if (in_array($item->getProduct()->getSku(), $uniuqProductSkus)) {
        continue;
    } else {
        // product is not yet found, push  into the uniuqProductSkus array
        array_push($uniuqProductSkus, $item->getProduct()->getSku());
        $_product                 = Mage::getModel('catalog/product')->load($item->getProductId());
        $product_small_image_path = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(200);
        $product_thumbnail_path   = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(150);
        $summaryData              = Mage::getModel('review/review_summary')->load($item->getProductId());

        echo "
";

        echo "

getProductUrl() . "'>";
        echo $item->getName() . "

";

        echo "
getProductUrl() . "'>";
        echo "";
        echo "
";

        echo "
";
        echo "
getProductUrl() . "#product_tabs_review_tabbed'>Review this beer now
";

        echo $summaryData->getRatingSummary() . '% Would buy again
';

        echo "
";
        echo "
getRatingSummary() . "%'>

";
        echo "
";

        echo "
";
        echo '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\'';
        echo $this->helper('checkout/cart')->getAddUrl($_product);
        echo '\')">Order Again</button>';
        echo "
";

        echo "

";

        echo "
";

        var_dump($uniuqProductSkus);
    }
}
}
?>


texts: Get total order value on success.phtml page using onepage checkout

texts:
I posted this question:
How can i get the order total value on success page easily? Magento 2.2
But it never got resolved. Unsure how to rerequest help about it. But I need to get it solved.

I am using magento 2.2.1

The page in question is using:

$block: \Magento\Checkout\Block\Onepage\Success

I am able to get the OrderID but not the grandtotal. I have tried all suggestions I have been able to recreate found on google and on this forum.

I need the grandtotal for creating a postback to the facebook pixel.

I am able to get the orderid using: $lastOrderId = $block->getOrderId();

And I have tried things like:

$lastOrderId = $block->getOrderId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->load($lastOrderId);
echo "order id: ". $lastOrderId;
echo $order->getGrandTotal();

Any suggestions?
Would very much appreciate some help


texts: Add class active to the current category Magento 2.3

texts:
How I can add a class "active" to the current / selected category? Magento 2.3
<?php
 // get the list of all categories
//echo "Hello";
//echo '

';
$_categories = $block->getCategoryCollection();

//var_dump($categories);
//echo "end";
 $category = $block->getCurrentCategory();
 $categoryId=$category->getId();

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $subCategory = $objectManager->create('Magento\Catalog\Model\Category')->load($categoryId);
 $subCats = $subCategory->getChildrenCategories();
 $_helper = $this->helper('Magento\Catalog\Helper\Output');

 ?>

 <?php foreach($_categories as $_category): ?>

        <a href="<?php echo $_category->getUrl(); ?>">
            <?php echo $_category->getName(); ?>

        <?php if ($category->getId() && $category->getId() == $_category->getId()): ?>
            <?php $_category = $objectManager->create('Magento\Catalog\Model\Category')->load($_category->getId());
            ?>
            <?php $subCats = $subCategory->getChildrenCategories(); ?>

                    <?php foreach($subCats as $subcat): ?>

                                <a class="" href="<?php echo $subcat->getUrl(); ?>">
                                    <?php echo $subcat->getName(); ?>

                    <?php endforeach; ?>

        <?php endif; ?>

<?php endforeach; ?>

How I can add a class "active" to the current / selected category?
Thank you


texts: Where is the Magento 1.9 developer documentation?

texts:
The only good/bonafide documentation I can find is here:

https://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-1.html

but in that documentation it even states that there's much more to learn. Is there any other good documentation?


texts: Change the structure of the footer in Magento2

texts:
I have a custom theme in my magento2 website which is a child of the luma theme.

I need to add in an extra div in the footer for styling purposes but I can't find anywhere in all of the files in the site where this is being created?

            ... (social links) ...

           ... (you can find us) ...

            ... (footer links) ...

            ... (copyright) ...

            ... (insta widget) ...

This is how the footer is currently rendered, and I know how to add and remove sections to it in my layout file but I can't workout where to add my extra div in this location;


texts:
I've set up my new magento website and I am in need to get all the products to this website. I do not need any other data! The problem is I only have the database of previous shop and no product csv file etc.

Can anyone suggest which parts I should move to a seperate .sql from that database dump to successfully inject previous shop's products to my new database?


texts:
I am using below code in my custom phtml

$object =  \Magento\Framework\App\ObjectManager::getInstance();
$cart = $object->get('Magento\Checkout\Model\Session')->getQuote()->getAllVisibleItems();
$cartCount = count( $cart );
if($cartCount > 0){
    echo $cartCount;
    } else{
        echo "0" ;
    }
    ?>

It return correct count only cart page rest all page it return 0 only


texts: Magento does not find the theme in the 'vendor'

texts:
I'm developing a theme for Magento 2 (learning), I'm following the documentation and everything is going very well, my theme is recognized by Magento, when I put it in 'app / design'.
But I would like to make this theme available via composer, but when installing it is not recognized by Magento, it will end up within the 'vendor / paul / theme-test' defined by me and nothing else happens.
Is there anything else I need to do? I'm using the magento Luma files as a base.
Can someone help me?


texts: Magento Different Websites & Catalogues - One Installation

texts:
Im running a magento installation that has 2 websites that share the same catalogue and the same admin-user access.
How can I use the same installation for creating other websites with different catalogues and make every one of them private ?
[ Private means without seeing any trace of other shops running on the same installation ]

Any information is appreciated!


texts: In my store  checkout page getting error for address i can't figure out why this error comes if i move ship here than error comes.if any one idea please reply!


texts: Magento place order redirects to shopping cart empty

texts:
I just changed my server, all the files and database are the same i had previously.
Now all of sudden i am having this issue.
I add item to cart, go to checkout page, click on place order and magento start processing order and rather than going on the Checkout Success Page magento shows "SHOPPING CART EMPTY" but the order is also placed and is visible in magento sales and email is also sent to the customer.

I thought it was the permission issue so i used the magento-cleanup.php file but no luck.

What could be the issue?


texts: I want to display the color and size of the configurable product in the catalog product list page

texts: I am using magento 1.9.3,I want to display both color and size of the configurable product in the catalog product list page. now i have the color only. if I change it to size in configuration, then it shows size. I want both on list page


texts: Product API returning product url as admin url, not store url

texts:
Note:  This is on Magento EE 1.13.1.0

I had to extend Mage_Catalog_Model_Api2_Product_Rest_Guest_V1::_prepareProductForResponse to make some custom changes to the product feed.  But, interestingly, the url being returned from the products has the admin url, and not the frontend store url.  For isntance, I make this call to the API:

http://store.example.dev/api/rest/products?store=33&limit=100&page=1&category_id=63

And the  tag returned in the feed is this:

http://admin.example.dev/index.php/the-product.html

Instead of:

http://store.example.dev/the-product.html

Near the top of the _prepareProductForResponse method, I can see that it's trying to set the website id on the product object:

$product->setWebsiteId($this->_getStore()->getWebsiteId());

But that doesn't seem to have any effect.  I tried setting the store id instead with:

$product->setStoreId($this->_getStore()->getId());

That works to get the correct url, but it also ends up adding the store parameter to the url, even though the system config is set to not display it.

I thought about doing a preg_replace to just remove the store param, but that is hacky, and I don't want to do that.

Anybody have any ideas on how to fix this?


texts: Tier Prcing not showing on Magento 2.2.4

texts:
I have created a simple product and set prices like on the image is shown.

But it is not showing on the front-end side. Does the tier prices work with simple or not ? and second, why it's not showing on product pages if it's working with simple ?  I am using Magento 2.2.4.Thanks


texts:
Upload the customer image in the backend.But not display the image preview.(magento 2.2.5)

I'm using this extension

  https://github.com/php-cuong/magento2-customer-avatar

How to fix the issue?

Thanks


texts: How to repopulate form data in magento if email already available

texts:
I created cumstom module for seller registration in magento.
On email validation if email is already available...my form reloading with error email already available...

On that time my form whole value goes empty....

I need to know that how to repopulate data in fields on ...error in magento..on form reloading...

my one line html is..

                    *<?php echo $this->__('Enter Your Name') ?>

                        <input type="text" name="vname" id="vname" value="" title="<?php echo $this->__('Enter Your Name') ?>" class="input-text  required-entry" />

                    *<?php echo $this->__('Email Address') ?>

                        <input type="text" name="email" id="email_address" value="" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />


texts: White Screen During Setup. Tried everything

texts:
I'm trying to set up Magento locally using MAMP, and I'm getting the WSOD.

I've changed permissions, to the point that just about everything has full permissions, and still nothing

I'm running PHP 7.2, and I've been able to run composer install without any issues. When I check the network tab, I see the setup index.php come through with a 500 error.

my cgi.fix_pathinfo is set to 1, I have a DB created in PHPMyAdmin with the same name as the root folder, and both the debug log and system log have 2 lines that say:

main.ERROR: Error: Application is not installed yet.  [] []


texts: Magento2 - how to use user defined function without use of helper?

texts:
I have my own function for making developing easy

Like :

function pr($data,$exit){
    echo "<pre>";
    print_r($data);
    if($exit)
        die;
}

$collection=$this->pincodeCollection->create();
    pr($collection->getData(),1);

Magento2 has helper concept but for helper function use we have to injection helper in the constructor of the class file
So I want to avoid this step

In Magento2 any better way where we define our own function. and use everywhere of php code

Your help is appreciated


texts:
i want to append some extra thing to all product name in view cart how can i do it via observer

please tell which observer should i use or call for that


texts: How to allow Notify me when Product back in stock for Guests / not Logged-In users?

texts:
I want to notify to customer and guests, when products back in stock, But in magento this feature is working only for customers, who is register on my website, But i want allow to also guests and not logged in customers. How to i can do this ?
Thanks


texts:
I am a magento beginner and need help with creating a new custom block.
Basically, I just want the block to show "hello" if it is called.

Module installation xml file, app/etc/modules/MyExtensions_HelloBlock.xml

<?xml version="1.0" encoding="UTF-8"?>
 <config>
    <modules>
      <MyExtensions_HelloBlock>
         <active>true</active>
         <codePool>local</codePool>
     </MyExtensions_HelloBlock>
   </modules>
</config>

Module configuration xml file, app/code/local/MyExtensions/HelloBlock/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
  <config>
    <modules>
     <MyExtensions_HelloBlock>
         <version>0.0.1</version>
     </MyExtensions_HelloBlock>
   </modules>
   <global>
     <blocks>
         <helloblock>
             <class>MyExtensions_HelloBlock_Block</class>
         </helloblock>
     </blocks>
   </global>
</config>

Block class, app/code/local/MyExtensions/HelloBlock/Hello.php.

<?php
class MyExtensions_HelloBlock_Block_Hello extends  Mage_Core_Block_Template
{
   public function hello()
   {
   echo "hello";
   }
}

Template file for the block, app/design/frontend/default/default/template/helloblock/hello.phtml

<?php
 $this->hello();
?>

Then I call my new block like this in the template "app/design/frontend/venedor/default/template/page/1column.phtml"

echo $this->getLayout()->createBlock('helloblock/hello')->setTemplate('helloblock/hello.phtml')->toHtml();

Result:

  Fatal error: Call to a member function setTemplate() on boolean in
  /app/design/frontend/venedor/default/template/page/1column.phtml
  on line 58

I was following this tutorial.


texts: I have problems when importing data. What can I do to fix it ? 99% loading.... fail :(


texts: Integrating boilerplate themes with magento

texts:
Has anybody dealt with integrating boiler plate themes in magento? Here are some links:
- waterlee-boilerplate
- magento boilerplate

I've installed comapass, sass, converted css to scss, wrote custom layout and template files in app/design/frontend, but it didn't work. Help me.


texts: How to get current store id from current scope in admin

texts:
How do I get the store id of the current scoped store in the admin?

For instance, if I use the drop down box in the upper left hand corner, and change the scope to a store view, how would I get the store id of the currently scoped store view...

Global
-> Website
--> Store
---> Store View (This is currently the scope, how do I get this store's id?)

We are working on a admin module someone else wrote, it is broken, the fix for the module appears to be passing a helper the store id of the currently scoped store...


texts:
How do we get Magento 2.1.1 migration (from 1.8.1.0) to skip the checks below, so that we can move past these errors?

[2016-09-13 21:48:27][INFO][mode: data][stage: volume check][step: EAV Step]: started
100% [============================] Remaining Time: 1 sec
[2016-09-13 21:48:27][ERROR]: Class catalog/product_attribute_backend_finishdate does not exist but mentioned in: eav_attribute.backend_model for attribute_id=78
[2016-09-13 21:48:27][ERROR]: Class ultramegamenu/category_attribute_source_block_proportions does not exist but mentioned in: eav_attribute.source_model for attribute_id=138
[2016-09-13 21:48:27][ERROR]: Class ultramegamenu/category_attribute_source_categorylabel does not exist but mentioned in: eav_attribute.source_model for attribute_id=141
[2016-09-13 21:48:27][ERROR]: Class seosuite/catalog_product_attribute_source_meta_robots does not exist but mentioned in: eav_attribute.source_model for attribute_id=142
[2016-09-13 21:48:27][ERROR]: Class seosuite/catalog_product_attribute_backend_meta_canonical does not exist but mentioned in: eav_attribute.backend_model for attribute_id=143
[2016-09-13 21:48:27][ERROR]: Class seosuite/catalog_product_attribute_source_meta_canonical does not exist but mentioned in: eav_attribute.source_model for attribute_id=143
[2016-09-13 21:48:27][ERROR]: Class seosuite/system_config_source_crossdomain does not exist but mentioned in: eav_attribute.source_model for attribute_id=144
[2016-09-13 21:48:27][ERROR]: Class seosuite/catalog_product_attribute_source_meta_robots does not exist but mentioned in: eav_attribute.source_model for attribute_id=146


texts: How to get sales order address custom column value in order REST API magento 2.3.2 EE

texts: We have a partner vendor they just run order REST API with the search criteria order status in processing. While they run the order REST API they get all the values related to orders and shipping address under extension attributes. once they get shipping address id from this they will run the rest api to get customer address as hey are unable to get the door number value as this is a custom column in sales order address table. But they don't want to run the address api. they want door number in the order api itself. could you please suggest me a workaround.


texts: How to install an older version of M2 with composer?

texts:
I need to install one minor version down from the current 2.1.2 using Composer.

I try:

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition 2.1.0 /home/m2track/public_html

However I get :
" Could not parse version constraint /home/m2track/public_html: Invalid version string "/home/m2track/public_html" as an error.

What is the correct syntax to install 2.1.0 or 2.1.1 using composer ?


texts: Magento2 : Set Limitation for Logged in customer address on checkout page?

texts:
I want to set the limitation for count of address list on the checkout page.

can we restrict it or not, if yes then How to do that.

Thanks in advance.


texts:
i dont know how make a function with custom var for getQty for use in my custom message. My block code:

class Sc_StockMessages_Block_Messages extends Mage_Catalog_Block_Product_Abstract {
    public function getMessage(){
    $_product = $this->getProduct();
    $quantity=Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
    if($quantity<= Mage::getStoreConfig('stockmessages/option/stockmessages_min_qty')) {
    echo Mage::getStoreConfig('stockmessages/option/stockmessages_message')  . intval($quantity) . " ";

And my custom phtml is...:
$stockQty = $this->getMessage();

    echo $this->__($stockQty);

My result is: The stock is below than %s items 10 (i want to make the value 10 associate with the var %s, how i can do this? Thanks.


texts: Magento 2.3 - How to move payment method list to the first step of checkout

texts: Is it possibile to move "payment method list" from 2° step checkout to the 1° step checkout? How can I do that?


texts: Error when creating order from admin panel (Invalid method Mage_Sales_Model_Order::queueNewOrderEmail)

texts:
We are running Magento CE 1.9.3.8 and have noticed an issue when creating an order manually from the admin panel (Sales > Orders > Create New Order).

When we create an order the following error is returned immediately after pressing the "Submit Order" button:

Order saving error: Invalid method Mage_Sales_Model_Order::queueNewOrderEmail(Array () )

A screenshot of the error is below:

From this post there was a suggestion to check for the presence of the queueNewOrderEmail function in app/code/core/Mage/Sales/Model/Order.php - I can confirm this is present.

I also could not see any cases where queueNewOrderEmail was being overridden. Here's a list of files referencing that function:

app/code/core/Mage/Sales/Model/Order.php:    public function queueNewOrderEmail($forceMode = false)
app/code/core/Mage/Sales/Model/Order.php:        $this->queueNewOrderEmail(true);
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php:            $order->queueNewOrderEmail();
app/code/core/Mage/Checkout/Model/Cart/Api.php:                    $order->queueNewOrderEmail();
app/code/core/Mage/Checkout/Model/Type/Onepage.php:                    $order->queueNewOrderEmail();
app/code/core/Mage/Checkout/Model/Type/Multishipping.php:                    $order->queueNewOrderEmail();
app/code/core/Mage/Authorizenet/Model/Directpost.php:                $order->queueNewOrderEmail();
app/code/core/Mage/XmlConnect/Model/Paypal/Mep/Checkout.php:                $order->queueNewOrderEmail();
app/code/community/Ess/M2ePro/Model/Buy/Order.php:            if (method_exists($this->getParentObject()->getMagentoOrder(), 'queueNewOrderEmail')) {
app/code/community/Ess/M2ePro/Model/Buy/Order.php:                $this->getParentObject()->getMagentoOrder()->queueNewOrderEmail(false);
app/code/community/Ess/M2ePro/Model/Ebay/Order.php:            if (method_exists($this->getParentObject()->getMagentoOrder(), 'queueNewOrderEmail')) {
app/code/community/Ess/M2ePro/Model/Ebay/Order.php:                $this->getParentObject()->getMagentoOrder()->queueNewOrderEmail(false);
app/code/community/Ess/M2ePro/Model/Amazon/Order.php:            if (method_exists($this->getParentObject()->getMagentoOrder(), 'queueNewOrderEmail')) {
app/code/community/Ess/M2ePro/Model/Amazon/Order.php:                $this->getParentObject()->getMagentoOrder()->queueNewOrderEmail(false);
app/code/community/Phoenix/Moneybookers/Model/Event.php:                $this->_order->queueNewOrderEmail();

Here's what is logged in var/log/exception.log:

Trace: #0 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php(1572): Varien_Object->__call('queueNewOrderEm...', Array)
#1 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php(1572): Mage_Sales_Model_Order->queueNewOrderEmail()
#2 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php(499): Mage_Adminhtml_Model_Sales_Order_Create->createOrder()
#3 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_Order_CreateController->saveAction()
#4 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')
#5 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 /var/www/vhosts/domain.com/httpdocs/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#7 /var/www/vhosts/domain.com/httpdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#8 /var/www/vhosts/domain.com/httpdocs/index.php(83): Mage::run('', 'store')
#9 {main}

How can we troubleshoot this? The core code has not been modified yet it appears to be referring to core code in the errors.


texts: How to integrate third party php library css, js and other static files in Magento 2?

texts:
There is a library that has some CSS, js assets. I want to include this library and use its assets in Magento 2. I am prepared to write a module for this, but I don't know where to start.
I first went with the approach of copying the files to the lib/web directory, but when it went to Magento-cloud the code collapsed as we do not have write access to that folder. Then I stumbled upon the file 'vendor/magento/module-deploy/Source/Lib.php' and tried to recreate it. I was not able to place the files in the static directory and I got the error of 'Unable to resolve the source file'.
My code in the di.xml
<type name="Magento\Deploy\Source\SourcePool">
    <arguments>
        <argument name="sources" xsi:type="array">
            <item name="customassets" xsi:type="object">*\*\Source\Assets</item>
        </argument>
    </arguments>
</type>

Assets.php file
'<?php
namespace **\Source;
use Magento\Deploy\Package\Package;
use Magento\Deploy\Package\PackageFileFactory;
use Magento\Deploy\Source\SourceInterface;
use Magento\Framework\App\Utility\Files;
class Assets implements SourceInterface
{
const TYPE = 'customassets';
/**
* @var Files
/
private $filesUtil;
/*
* @var PackageFileFactory
*/
private $packageFileFactory;
public function __construct(
    Files $filesUtil,
    PackageFileFactory $packageFileFactory
) {
    $this->filesUtil          = $filesUtil;
    $this->packageFileFactory = $packageFileFactory;
}

public function get(): array
{
    $files              = [];
    $pattern            = BP . "/vendor/*/*/src/*/*/assets";
    foreach (Files::getFiles([$pattern], '*') as $file) {
        $path          = str_replace(DIRECTORY_SEPARATOR, '/', BP);
        $fileName      = $this->_parseAssets($file, $path);
        $params             = [
            'area'       => Package::BASE_AREA,
            'theme'      => null,
            'locale'     => null,
            'module'     => null,
            'fileName'   => $fileName,
            'sourcePath' => $file
        ];
        $files[]        = $this->packageFileFactory->create($params);
    }

    return $files;
}

/**
 * Parse file path from the absolute path of static library
 *
 * @param string $file
 * @param string $path
 *
 * @return string
 */
protected function _parseAssets(string $file, string $path): string
{
    preg_match(
        '/^' . preg_quote("{$path}/vendor/*/*/src/*/*/", '/') . '(.+)$/i', $file,
        $matches);

    return 'custom/assets/' . $matches[1];
}

}


texts: Magento2.2 links not working after migration of site

texts:
I have a magento 2.2. based website I had setup on a hosting account that used domain http://development.domain.com . I now moved the mysql and the files over to what will be the production hosting account so the site is now located at http://www.domain.com/v2
After I moved the files and database I then via mysql workbench edited the core_config_data table making the web/unsecure/base_url and the web/secure/base_url . columns have www.domain.com/v2/ .

However now when I go to http://www.domain.com/v2 the main magento page loads however if I click any category or product it redirects me to www.domain.com/ .  So like if I click a category named shirts I am being directed to http://www.domain.com/shirts instead of https://www.domain.com/v2/shirts

I also am not able to access the admin panel it just redirects to the url without the /v2/    I checked .htaccess doesnt have any rewrite rules.

I also re-indexed on the cli and compiled and cleared cache. still no change?
So what am I miising to do?


texts: Magento 1: change setting Display out of stock products to NO & effect on performance of indexers and db

texts:
Question: how much effect does disabling the setting Display out of stock products to NO in Stock options have?
Does it improve indexer speed? Does it improve layered navigation building? Does it improve DB lookups?
We are asking becuase we have 80% old products out of stock from previous years that do nothing and will not come back


texts:
We are moving all of our site's mail communication to Gmail for Work. The DNS settings and integration was done and Gmail seems to taken over the mail processing for all e-mails sent to our shop's addresses, except for those sent directly through Magento (sales e-mails for example).

My guess is that the problem is due to the fact that Magento's e-mails use PHP SMTP functions, and those work directly with mail server which is on the same domain as the site. So when the mail server gets the message, it recognises the same domain, and processes the mail by itself, and because of it no e-mails are pushed to Google, but instead, we still get them in the old way.

I'm not sure how to fix this? Should I do it on the application level, through Magento classes, or to try and fix some PHP setting for this?


texts: Magento2 : How to override contacts form.phtml in child theme

texts:
I want to change page title in child theme for contact-us page. But when I'm trying to override file Magento_Contact/templates/form.phtml in my child theme from parent theme then on frontend the page showing blank. I also copied layout/contact_index_index.xml and all other templates too, still template file overridden not working.

How do I override Magento_Contact/templates/form.phtml?

My Parent theme contact_index_index.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact Us</title>
    </head>
    <body>
        <referenceContainer name="page.top">
            <block class="Namespace\Theme\Block\Template" name="google_map" template="Magento_Contact::google_map.phtml"/>
        </referenceContainer>
        <referenceContainer name="content">
            <block class="Namespace\Theme\Block\Template" name="contactPage" template="Magento_Contact::contact_page.phtml">
                <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                    <container name="form.additional.info" label="Form Additional Info"/>
                </block>
            </block>
        </referenceContainer>
    </body>
</page>


texts: Magento 2 : Required fields in checkout are no longer required

texts:
I have a strange issue in Magento 2 (2.1.9), and I was wondering if anyone encountered something like this before. The required fields in the checkout usually have a required-class, but for some reason they now have a class called _required. This goes for all input elements. Validation is still applied, so if I click 'Next' or tab-focus to another input-field I still get the errors that the fields are required.

Anyone encountered this before and/or know what might cause this? I only have 2 external modules, but disabling these modules make no difference.


texts: How to disable Paypal method for a specific customer group?

texts:
I'm actually using a payment filter by customer group extension on my magento 1.9 CE. That let me control which payment method can have access my clients based on their customer group. Unfortunately this filter doesn't seem to apply to Paypal Express (it shows up anyway for all clients). Any idea?

Mod edit: extension code publicly available on GitHub.


texts: Is multiple inheritance allowed in Magento?

texts:
When go through the core source, I figured out that some classes have been extended by many child classes.

Eg:

   class Mage_Sales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Abstract

   class Mage_Sales_Model_Quote_Address_Total_Subtotal extends Mage_Sales_Model_Quote_Address_Total_Abstract

Is this allowed for any class or only for some classes?

Any suggestions will be appreciated. Thanks in advanced.


texts: How to filter duplicate values in magento array?

texts:
I am trying to get attribute option values for specific products.

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $baseUrl = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore(0)->getBaseUrl();
        $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
        $connection = $resource->getConnection();
        $product1 = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
        $op_array = array();
        $val_array = array();
        $_product = $objectManager->create('Magento\Catalog\Model\Product')->load($product1->getId());
        $_childProducts = $_product->getTypeInstance()->getUsedProducts($_product);
        foreach ($_childProducts as $simpleProduct){

            // echo '
' , var_dump($simpleProduct->getData()) , '
';
            $sku = $simpleProduct->getSku();
           // echo "
";
            $stringSku = '"' . $sku . '"';
            $sql = "select * from inventory_stock_4 where sku =". $stringSku;
            $result = $connection->fetchAll($sql);
            //var_dump($result);
            //echo $option_label = $result[0]['quantity'];
            //echo "
";
            $tableName = $resource->getTableName('eav_attribute_option_value');

            $sql2 = "select distinct * FROM " . $tableName . " where option_id=".$simpleProduct['jasani_size'];
            $result2 = $connection->fetchAll($sql2);
            $option_label = $result2[0]['value'];
            foreach($result2 as $size){

               var_dump($size);
    }

I get an array like this

         array(4) { ["value_id"]=> string(3) "611"
    ["option_id"]=> string(2) "25" ["store_id"]=> string(1) "1"
["value"]=> string(2) "XS" }
         array(4) { ["value_id"]=> string(3) "612"
     ["option_id"]=> string(2) "25" ["store_id"]=> string(1) "0"
["value"]=> string(2) "XS" }
        array(4) { ["value_id"]=> string(3) "613"
    ["option_id"]=> string(2) "25" ["store_id"]=> string(1) "3"
["value"]=> string(2) "XS" }
         array(4) { ["value_id"]=> string(3) "614"
    ["option_id"]=> string(2) "25" ["store_id"]=> string(1) "4"
 ["value"]=> string(2) "XS" }
         array(4) { ["value_id"]=> string(3) "619"
    ["option_id"]=> string(2) "27" ["store_id"]=> string(1) "1"
 ["value"]=> string(1) "M" }
        array(4) { ["value_id"]=> string(3) "620"
    ["option_id"]=> string(2) "27" ["store_id"]=> string(1) "0"
["value"]=> string(1) "M" }
        array(4) { ["value_id"]=> string(3) "621"
    ["option_id"]=> string(2) "27" ["store_id"]=> string(1) "3"
["value"]=> string(1) "M" }
         array(4) { ["value_id"]=> string(3) "622"
     ["option_id"]=> string(2) "27" ["store_id"]=> string(1) "4"
 ["value"]=> string(1) "M" }

I get this repeated values like XS and M I can't filter unique vales in this.
I also tried array_unique(), array_filter() nut no use.


texts:
I am using windows OS. I have configured grunt already.

In Magento 2.2.5, I have created the custom theme called "cluster". I followed this turorial. While doing the setup-content:deploy i am getting this error.

Update:
I have \app\design\frontend\Vendor\cluster\web\css\email-inline.less file with below content.

@import 'source/_variables.less';

I have source\_variables.less with this content.


texts: Magento 2 - configuration product with multiple variation and each variation has multiple colors. Color swatches issue

texts:
I know what everyone will tell to me.... and please read before comments.
On Magento 2
When you create a configuration product with multiple variation Ofcourse and each variation has multiple colors (eg: 10 variations for the blue with a red Part and 10 BLUE with a yellow part and 10 BLUE with a green part and 10 white with a red part and 10 white with a yellow part and 10 white With a green part) AND you Don’t want to set the swatch image manually For each blue or yellow or green because this color attributes values are common to all other products and Other variations also!!
Color swatches: so you Use the fallback image option In visual swatch attribute- lets say « Color A » Attribute...(in my example blue and white...) if you have activated it ofcourse.
The only thing is: the fallback image for this configurable product will show you only One of the « Color A » images IN THE SWATCH and should Normally show the good « Color A » images with the color of the images of « colors B » values.
This is what we feel after a long day you know it already. I know you feel me and i hope you feel enough good for try it and tell me i’m true and I have to code something on top of magento because they doesn’t support : color swatch thumbnails for « Variations With Multiple attribute » in Configurable Products!
Lets take a shirt for example with different sleeves size and different color: the visual Swatch  Will ever show you the short sleeves as thumbnails even if you have selected the long sleeves and the main product photo will still be the good one its just a visual swatch Thumbnail issue.Damn!


texts: How do you iterate the resultset of a join?

texts:
I'm working with custom models in Magento, I need to populate a grid and in order to do that I need to join 2 tables, I used collections and the SQL seems to be right as a vardump will print the expected query, but I don't know how to access to the fields as when I iterate the collection nothing prints out.

Here is my code:

    $collection = Mage::getModel('myModule/permission')->getCollection()
    ->addFieldToSelect('unique_role_identifier')
    ->addFieldToFilter('user_name',array('eq'=>'userToMatch@FindMe.com'))
    ->getSelect()
    ->join('theroles',
            'main_table.unique_role_identifier = theroles.unique_role_identifier',
            array('role'=>'role_description'));
    var_dump((string) $collection); // prints the correct query
foreach($collection as $c){
            echo '<h3>'.$c->getRoleDescription().'</h3>'; //prints nothing
        }

Any help would be greatly appreciated.


texts:
Error from Updater Application Cron Script
Found non-writable path(s):
/home/USERNAME/public_html/.htaccess.sample

Any Solutions?


texts: Magento 2.1.6 : Configurable product is not added to cart

texts:
Im recentrly create a configured product (Size Attribute : S, M , XL)  Catalog Input Type for Store Owner Swatchtext.

when i select Any one of the size [S] [M] [L]   Click add to cart page will be redirct to  Url:www.xxxmagento/checkout/cart/.

Not Added any item in my Cart.


texts:
I have created attribute for products using following code in magento root

require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
    Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
    foreach(Mage::getModel('catalog/product')->getCollection() as $product)
    {
        $num= $product->getId();
       $test=generateEAN($num); //this is the values i have to set for the custom attribute of each product
       $installer = new Mage_Sales_Model_Mysql4_Setup;
       $attribute  = array(
        'type' => 'text',
        'label'=> 'test',
        'input' => 'text',
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'default' => $test,// i don't know this is the correct way to assign the value to each product
        'group' => "General"
    );

    $installer->addAttribute('catalog_product', 'testing', $attribute);
    $installer->endSetup();

    }


texts: Cache magento model objects transparently

texts:
Is there a standard way of making sure consecutive loading of models get the object from cache rather than DB? For example

$product = Mage::getModel('catalog/product')->load(3770);

This will first look at cache storage, if found return that, if not proceed with the loading, saving whats's loaded in to cache and return. This should also be combined with cache remove when ->save() method is called.


texts: Why does my custom adminhtml form select element have two options selected?

texts:
I have a custom form in my module (in admin). It has a select, whose default value should be "*", but instead, it has both "*" and "0" selected:

<select id="customer_group_id" name="customer_group_id" title="Customer Group" class=" select">
    <option value="*" selected="selected">ANY</option>
    <option value="0" selected="selected">NOT LOGGED IN</option>
    <option value="1">General</option>
    <option value="2">Wholesale</option>
    <option value="3">Retailer</option>
    <option value="4">Partners</option>
</select>

The field is being added to the form with this code:

$fieldset->addField('customer_group_id', 'select', array(
    'name'   => 'customer_group_id',
    'label'  => 'Customer Group',
    'title'  => 'Customer Group',
    'values' => $helper->getAvailableCustomerGroups(),
    'value'  => '*'
));

It gets its values from a function in my helper class. This function simply grabs all of the customer groups in the store, and also adds the "*" option.

function getAvailableCustomerGroups() {
    return array_merge(
        array('*'=>'ANY'),
        Mage::getResourceModel('customer/group_collection')->toOptionHash()
    );

}

Why does the form have TWO options marked SELECTED?


texts: Getting paging Parameter NULL in custom Dataprovider Magento 2.4

texts:
I have Created an Extension on Magento 2.4 where I have an Admin Grid whose data in provided By Custom Data Provider
public function getCollection()
{
    $identifier = 'my_indentifer';
    $data       = $this->cache->load($identifier);
    if (!$data) {
        $data       = $this->finalDataHelper->getProductFinalData();
        $collection = $this->serializer->serialize($data);
        $this->cache->save($collection, $identifier, $tags, 60000);
    } else {
        $data = $this->serializer->unserialize($data);
    }
    $pagesize    = intval($this->request->getParam('paging')['pageSize']);
    $pageCurrent = intval($this->request->getParam('paging')['current']);
    $pageoffset  = ($pageCurrent - 1) * $pagesize;
    return [
        'totalRecords' => count($data),
        'items'        => array_slice($data, $pageoffset, $pageoffset + $pagesize),
    ];
}

This Code is Working perfectly with Magento 2.3.X but in Magento 2.4 I am getting an error

Notice: Trying to access array offset on the value of type null

in these lines
    $pagesize    = intval($this->request->getParam('paging')['pageSize']);
    $pageCurrent = intval($this->request->getParam('paging')['current']);


texts:
We build some JSON from cart info and send it to Oracle for processing in our ERP.
Can I get the checkout time of the cart from Magento session?

Looking at getCreatedAt() but not sure what model to get it from.


texts: magento2 custom option Compatible File Extensions set not required

texts:
after migration my site,
i found one strenge issue that
when i saved product it not save,

after debbugging i found that

product has custom option of type file

and  Compatible File Extensions is required filed,

http://prntscr.com/izo2fm

how to set it to not required


texts: How to create custom API for company and customer creation in Magento 2

texts:
I want to create a company/company admin-user in Magento 2 (as what it does from the front-end/back-end panel) via a single API call.

Right now am doing with two API calls

  First is creating a customer, then creating a company by giving superuser_id=" " the customer_id I created earlier.


texts: Ordering JS/CSS load order across multiple xml blocks

texts:
When rendered, the below core XML loads the require.js file in (for example) Position 10 in the HTML Source:

vendor/magento/module-theme/view/frontend/layout/default_head_blocks.xml

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <css src="mage/calendar.css"/>
    <script src="requirejs/require.js"/>
</head>

And the following custom XML loads example.css file after in Position 11 of the HTML source:

app/design/frontend/Vendor/module/Magento_Theme/layout/default_head_blocks.xml

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <css src="example/example.css"/>
</head>

Example/Sample HTML Source

 9. <link rel="stylesheet" type="text/css" media="all" href="http://example.com/pub/static/version1234/frontend/Vendor/module/en_GB/mage/calendar.css">
10. <script type="text/javascript" src="http://example.com/pub/static/version1234/frontend/Vendor/module/en_GB/requirejs/require.js"></script>
11. <link rel="stylesheet" type="text/css" media="all" href="http://example.com/pub/static/version1234/frontend/Vendor/module/en_GB/example/example.css">

Question

How do I ensure that my example.css file loads before the requirejs-config.js?


texts: Duplicate Order for one payment through Paypal Express Checkout

texts:
Duplicate order on Magento v 1.9.1.0., triggered by:

PayPal API error code 10486

In short, the site responds to this error appropriately and as said in the doc: when the buyer's first payment is denied, the buyer is redirected back to PayPal.

(PayPal has confirmed this behavior, and told me to contact the developers in charge of this extension to report on this issue).

The problem seems to be linked to that redirection, which creates two orders in Magento (the two payment attempts — the first being denied by PayPal — are interpreted as two different orders/invoices. The buyer is charged once.).

Thus, in the backend (Sales > Orders) we can see for the same transactionid (PayPal) :

2 different order ID numbers (magento)
2 different correlationid
a «  Completed » vs. « completed » payer address status (different syntax)
an « IPN "Completed" » comment noticed on the first order

What could be done to solve this?

Thanks for helping!


texts: How do I use elements in Varien_Data_Form_Element_*?

texts:
In system.xml one can simply use elements like text and select and all the tutorials out there are using these two as examples. But how should I use other elements listed in lib/Varien/Data/Form/Elements folder?

For example there is a Fieldset and I noticed that it has getLegend and getElements methods but adding <legend>Some Text</legend> or <elements><!-- Elements --></elements> nodes did not work. How should I use them?


texts: When updating a widget instance programmatically, layout updates are removed

texts:
I tried to update a widget instance as follows (where /PATH/TO and WIDGET_INSTANCE_ID should be replaced by the actual values:

require_once '/PATH/TO/app/Mage.php';
Mage::app();
$widgetInstance = Mage::getModel('widget/widget_instance');
$widgetInstance->load(WIDGET_INSTANCE_ID);
$widgetInstance->setData('title', 'foo');
$widgetInstance->save();

After executing this code, all layout updates of the widget have been removed.

What could be the cause of this?


texts: How to programatically find files in a folder

texts:
I am creating a cron job for a Magento 2 site. This cron job will search for files in

  /var/custom_folder/

and will then process them.

I already have the cron job setup and can handle processing the file but I am wondering if there are any tools/libraries in magento 2 that can help with this process of finding files.

It is possible to do this without magento just using straight PHP commands but I am wondering if Magento has any tools that could help this process.

Part of the task that I will need to do when detecting these files is handle where they go as they are named in a certain format:

"part1-typeb-****.csv"


texts:
I have the following code in my install to create a table:

$installer->run(
    "CREATE TABLE IF NOT EXISTS `npcallnations_orders` (
        `id` INT AUTO_INCREMENT,
        `order` int,
        `status` int,
        `real_order_id` int,
        `customer` varchar(245),
        `fatdir` int,
        `created_at` DATETIME null,
        PRIMARY KEY (ID)
    )"
);

but if the magento has a table prefix, it will return an error when I try to use the collection. How can I do it so it will create correctly with prefix?


texts:
I have overridden the Mage_ImportExport_Model_Import_Entity_Abstract class and in the function  _saveValidatedBunches() I want to get the last created product Id. I've tried the following, but it returns null.

$collection = Mage::getModel('catalog/product')->getCollection();
$latestItemId = $collection->getLastItem()->getId();


texts: product image in png format showing black background on product detail page

texts:
I have uploaded a ".png" format image for a product at backend and it shows black background at detail page at front.

I want to show it as it is with png format and with no background.

I have tried in etc/view.xml like this :

 <image id="product_page_image_medium" type="image">
     <width>800</width>
     <height>800</height>
     <transparency>true</transparency>
     <background>[255, 255, 255]</background>
  </image>

but not working.
Any other suggestion please.


texts: I want to get a list of all products which are not in a specific category.


texts: transfer Database to another magento site to other magento site with different tempalte?

texts:
I'm tyring to rebuild new magento site from my previous one.
My New magento site will have different template and different version of magento site.

And I want to keep same catalog, order history, customer account history, categorioes.. all other database.    How can I transfer those information to another one safe?

I already know how to transfer all the database to another server but, i dont' know how to transfer database like old magento sample database.  so that I can start install new magento with old sample database.


texts: Email templates - variables names get translated instead of showing the value

texts:
I'm using magento 2.2.6.
My email templates are displaying the translation of the variable used and not their value.
I have installed a translation pack for Romanian.


texts:
We are considering using magento to create our ecommerce solution for selling mobile repair services. Here, in a typical scenario, a repair job is created by the customer and damaged mobile is sent to the service center by courier. The technician estimates the labor and provides a quote for that job to the customer manually. Customer reviews the charge and makes a payment. Can this pricing be achieved in Magento?
Thanks,
Noorul


texts: Magento 1.9.0.1 keeps log me out from admin panel

texts:
My magento admin loading unexpectedly slow. Though I am able to work but sometimes when we try to load ajax request, it gets expired and kicks user out from magento login.

Here's a error we got from console,

{"ajaxExpired":1,"ajaxRedirect":"https://xxxxx/index/login /key/18f7fc56cc065d0e2bb21f091ad1ac14/"}

For example, When I try to upload or insert image through WYSIWYG editor, Due to slow admin, it is taking too much time for processing AJAX request. so Ajax request is getting expired and kicks user out(log me out)from admin.

Can anyone help me to resolve it? Help Appreciated. Thanks!


texts: Orders not Posting to Magento 2.3.3 admin

texts:
I am facing an issue on our Magento2.3.3 website when order is placed via Purchase Order.

Some of the orders are missing in the admin but order confirmation emails are sent to customers.

Is anyone facing the same issue?

Thank you.


texts: Unable to display images in .thumbs directory with Apache 2.4, Magento 2

texts:
Not necessarily a Magento question but using Apache 2.4 and Magento 2, the HTML editor image uploader creates a directory

pub/media/wysiwyg/.thumbs

Which our server can't display.  Error is

[Thu Feb 23 21:35:52.824316 2017] [access_compat:error] [pid 17097] [client XXXXX:43009] AH01797: client denied by server configuration: /var/www/XXXXXXXX/pub/media/wysiwyg/.thumbs/XXXX.png

Vhost is

<Directory "/var/www/XXXXX/pub">
 Options FollowSymLinks
            AllowOverride All
            Options +Indexes
            Options +MultiViews
            Order allow,deny
            allow from all
    </Directory>

I know that's not Apache 2.4 but we're using access_compat to allow the old syntax.  I've been playing with the autoindex.conf but haven't been able to find the solution.

Anyone solves this yet?  It's not permissions as I can rename .thumbs to 'thumbs' and works fine.

Thanks!


texts: Position customAttributes on address-renderer

texts:
I am using an Address Fields Manager module.

The problem is that in the sidebar in the resume they are all seen together (address-renderer/ default.html) and I need to divide them:

<each args="data: address().customAttributes, as: 'element'">
<text args="$parent.getCustomAttributeLabel(element)"/>
</each>

Is it possible to separate the CustomAttributes and position it where I want?

The same thing that is done in the Custom Address Template?

Magento ver. 2.3.5-p1


texts:
Hi i am new to magento and currently learning custom module for most viewed product and the module works great.  now i have added a system.xml file below is the image.

system.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="netsmartz" translate="label" sortOrder="10">
            Netsmartz
        </tab>

            <class>separator-top</class>
            Most Viewed
            <tab>netsmartz</tab>
            <resource>Netsmartz_Mostviewed::mostviewed_config</resource>
            <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                General Configuration
                <field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Module Enable
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="display_text" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Module Name
                    <comment>
                        Enable the module to get the most viewed sorting option in frontend
                    </comment>
                </field>
            </group>

    </system>
</config>

config.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
                <Netsmartz_Mostviewed>
                        <general>
                            <use_cdn>1</use_cdn>
                                <display_text>Most Viewed</display_text>
                        </general>
                </Netsmartz_Mostviewed>
    </default>
</config>

now i want that when i hit module disable to no my module should be disable anyone have any idea how to achieve this.
Thanks in Advance!


texts: How to display shipping estimate and auto add this to grand total on cart page?

texts:
I am currently working on a magento website and trying to get the estimated shipping charge auto added to the grand total on the cart page. By doing this on the cart page I am trying to remove one of the steps later on in the check out process.

So to clarify and explain what i am trying to achieve It wold be best to explain it from a shoppers point of view.

1-Customer finds products
2-adds to cart
3-redirects to cart page
4-on this page it displays his cart along with the estimated shipping and tax block
5-Here customer enters his postcode and clicks button to get the shipping charges
6-The shipping charge is then shown which he has to select and then click update total.
7- The page will then load and update the grand total.

Now what I am trying to achieve is on step 5 when the customer enters his postcode and clicks get shipping. I would like the page to load and auto select the first or in my case the only shipping charge and also update the grand total. So there is no need for any action from the users part. He just has to click checkout to move to check out page.

I have looked in to the cart.phtml and shipping.phtml files. However i am not able to figure out how to achieve the above.

Advice and guidance will be appreciated.

Thanks


texts: Magento 2:Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider

texts:
I'm struggling trying to solve this very annoying problem on my Magento 2.3.3 store.
Today I forced the SSL on the website (I did it that by enabling the https on the unsecure URL). After 10-15 mins, while I was editing some coupon codes, I got this notification on my backend:

Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider.

I tried EVERYTHING. The /app folder has the .htaccess file and has this rule (everybody was suggesting this as a fix).

<IfVersion < 2.4>
    order allow,deny
    deny from all
</IfVersion>
<IfVersion >= 2.4>
    Require all denied
</IfVersion>

All my folders seem to have 755 and all the files 644 permission.

PLEASE NOTE: This error occurs when the /app folder is visible to everybody. The weird thing is that if I try to navigate on that folder, or app/etc/config.php, it gives me error 404, so it looks like my files are safe.

Why I'm getting this error?

PLEASE, HELP !!!


texts: Get Multi-Select Attribute Values without commas

texts:
I'm using this to display values of a multi select attribute.

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

The result is value1, value2, value3

Can someone suggest how to replace the commas with line breaks?


texts: Magento2: broken layout after installing extension and css is missing

texts:
I've just installed a plugin and now magento isn't working anymore.

Firstly i thought this was due to the plugin but even after disabling/removing the plugin the problem persists.


texts: send an additional email to customer to inform we are delivering the product in magento

texts:
send additional emails to customers through magento admin panel.

as in default magento , we have an option for sending mails when customer ordered the product.

and when we click invoice  and shipment and credit memo button.

we want to send a mail to customer to inform we are delivering the product.

is there any option to do that through automatic way?


texts: Magento 2 command line install (too many arguments)

texts:
so I am trying to make a bash script in Magento, and I am learning from the bottom up.
So I have the basic arguments ready to be used in the script I am making, but when I execute

sudo php magento setup:install --admin-user="user"

or a variation with [--admin-user="user"]

I get

[RuntimeException]
Too many arguments.

What am I doing wrong? I would like to put that line in my script, so I can install Magento with user defined variables

I am using Magento 2.0.2 with Sample Data on Ubuntu 15.02


texts: How to include custom block in default block?

texts:
I have created a custom Extension.

In this Extension, I need to show some content in product description page.

How can i include that block using layout.xml.

<catalog_product_view translate="label">
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
            .
            .
            .
            <-- My Block Load Here -->
            <block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
            .
            .
            .
        </block>
    </reference>
</catalog_product_view>

My Block Here:

<block type="xxx/yyyy" name="xxx.content" as="" template="xxx/xxx.phtml" />

What are the code add in my module xml file(app/design/frontend/default/default/layout/xxx.xml).

I no need to update anything in default phtml and layout file.

Please share your ideas.

Thanks.