texts: How to validate Image in admin custom form in magento?

texts:
I create custom form in admin panel in magento.Here I tried in many way to validated image tags in admin panel.

  /app/code/community/company_name/module_name/Block/Adminhtml/module_name/Edit/Tab/image.php

my Image tag containing code :

protected function _prepareForm()
    {
        /**
         * Checking if user have permissions to save information
         */
        if (Mage::helper('magentostudy_news/admin')->isActionAllowed('save')) {
            $isElementDisabled = false;
        } else {
            $isElementDisabled = true;
        }

        $form = new Varien_Data_Form();

        $form->setHtmlIdPrefix('news_image_');

        $model = Mage::helper('magentostudy_news')->getNewsItemInstance();

        $fieldset = $form->addFieldset('image_fieldset', array(
            'legend'    => Mage::helper('magentostudy_news')->__('Pattern Image Thumbnail'), 'class' => 'fieldset-wide'
        ));

        $this->_addElementTypes($fieldset);

        $fieldset->addField('image', 'image', array(
            'name'      => 'image',
            'class'     => 'required-entry',
            'label'     => Mage::helper('magentostudy_news')->__('Pattern Image'),
            'title'     => Mage::helper('magentostudy_news')->__('Pattern Image'),
            'required'  => true,
            'disabled'  => $isElementDisabled
        ));

        Mage::dispatchEvent('adminhtml_news_edit_tab_image_prepare_form', array('form' => $form));

        $form->setValues($model->getData());
        $this->setForm($form);

        return parent::_prepareForm();
    }

Here I put class required value and also gives 'required'  => true, in my form.

Updated:

Here, same functionality can be applied in text box, it working fine ..

Here path location for text box.

  /app/code/community/company_name/module_name/Block/Adminhtml/module_name/Edit/Tab/Main.php

and also working fine in this coding....

protected function _prepareForm()
    {
        $model = Mage::helper('magentostudy_news')->getNewsItemInstance();

        /**
         * Checking if user have permissions to save information
         */
        if (Mage::helper('magentostudy_news/admin')->isActionAllowed('save')) {
            $isElementDisabled = false;
        } else {
            $isElementDisabled = true;
        }

        $form = new Varien_Data_Form();

        $form->setHtmlIdPrefix('news_main_');

        $fieldset = $form->addFieldset('base_fieldset', array(
            'legend' => Mage::helper('magentostudy_news')->__('Pattern Item Info')
        ));

        if ($model->getId()) {
            $fieldset->addField('news_id', 'hidden', array(
                'name' => 'news_id',
            ));
        }

        $fieldset->addField('title', 'text', array(
            'name'     => 'title',
            'label'    => Mage::helper('magentostudy_news')->__('Pattern Title'),
            'title'    => Mage::helper('magentostudy_news')->__('Pattern Title'),
            'required' => true,
            'disabled' => $isElementDisabled
        ));

        $fieldset->addField('author', 'text', array(
            'name'     => 'author',
            'label'    => Mage::helper('magentostudy_news')->__('Pattern Model Id'),
            'title'    => Mage::helper('magentostudy_news')->__('Pattern Model Id'),
            'required' => true,
            'disabled' => $isElementDisabled
        ));
 [...............]

and also I attached my text box validation.

Same functionality is implement in file type, but not working in file type. I just putting class =>'required-entry',it not working well,Please guide me...


texts: How can I add icons login in Magento Homepage header?

texts: How can I add icons social and  login in Magento 1.9 Homepage header?


texts: Apply Discount and Cancel Discount is not work on my Custom Tab

texts:
I have created a Module in which Created some custom Tab and on that tab i have added discount coupon code.
I have added

    <form class="form form-discount" id="discount-form">

                    <input class="input-text"
                           type="text"
                           id="discount-code"
                           name="discount_code"
                           data-validate="{'required-entry':true}"
                           data-bind="value: couponCode, attr:{disabled:isApplied() , placeholder: $t('Enter discount code')} " />

                    <button class="action action-apply" type="submit" data-bind="'value': $t('Apply Discount'), click: apply">

                    </button>

                    <button class="action action-cancel" type="submit" data-bind="'value': $t('Cancel'), click: cancel">

                    </button>

    </form>

It shows discount coupan but it doesn't work

As i have shared image where i have added the coupan code.
How should it worked or I have skip some step?


texts: Product brand (attribute, category or both)?

texts:
I am fairly new to Magento module development, and I am dealing with catalog/product pages at the moment.

I have seen our clients using different approaches when dealing with storing product brands.

Store them under the default manufacturer attribute.
Store them under a custom attribute (which is named brand, or whatever)
Store brands as categories and assign the product to that brand/category. The product then has multiple categories e.g: ['Apple', 'laptop'] or ['Apple', 'ipad'], etc. Sometimes even ['Brands', 'Apple', 'categories', 'laptop']

So my first question is whether there is a best practice to storing product brands?

My module requires extraction of the product brand attribute, and in [1,2] approaches, it is pretty straight forward. I simply get the product attribute text of brand attribute (I ask them to specify the brand attribute in module configuration).

However [3] is a bit different approach, so I would also want to know what would be the best way in Magento achieving that

The way I am doing it now is I take all product categories, and check whether the category is a child of a 'Brands' category. Is this performant enough for production use?:

private function getProductBrandFromCategory($product, $parentCategoryIdToLookFor) {
    $categoryCollection = $product->getCategoryCollection();

    foreach($categoryCollection as $_productCategory) {
        $_parentCategories = $_productCategory->getParentCategories();

        foreach($_parentCategories as $_parentCategory) {
            if($parentCategoryIdToLookFor != $_productCategory->getId() && in_array($parentCategoryIdToLookFor, $_parentCategory->getPathIds())) {
                return $_parentCategory->getName();
            }
        }
    }

    return null;
}

Now obviously I do now want to have different module versions per different set-ups, so I would like to come up with a generalised solution. What are the ways of solving this kind of problems, I am sure I can't be the only one dealing with such issues.

My thought on the generalised version is to have two fields in module configuration, a dropdown and a text field. The dropdown would contain all product attributes, and if they have [1,2] approach, they would select the appropriate attribute name from the dropdown, and leave the text field empty.

For set-up [3], they would leave the dropdown untouched and enter the name of the category, under which all the brands are stored.

Would this be a good approach towards that?

I know it might look like a long question, so please tell me if something is unclear. Looking forward to the answers.


texts: How to change (USD) to (RS) on advanced search page.

texts: I am building an ecommerce magento website name www.bookslab.in. I want to change the (USD) on advanced search tab to "(RS)" as i am selling the books only in india, so i need the indian currency which is Rupees(RS). I had attached an screenshot of advanced search page. Please suggest.


texts: Magento 2: How to create setup:upgrade programmatically

texts:
I want to create a function to allow run setup upgrade, but I don't want to use shell script to call setup:upgrade command. I tried reading in core function and found this code
        $request = $input->getOptions();
        $keepGenerated = $input->getOption(self::INPUT_KEY_KEEP_GENERATED);
        $installer = $this->installerFactory->create(new ConsoleLogger($output));
        $installer->updateModulesSequence($keepGenerated);
        $installer->installSchema($request);
        $installer->installDataFixtures($request);

But I tried using this code for my function but I had one issue like this

Uncaught Error: Cannot instantiate interface
Zend\ServiceManager\ServiceLocatorInterface in
/var/www/html/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50

I fixed this issue by creating a preference for ServiceLocatorInterface
<preference for="Zend\ServiceManager\ServiceLocatorInterface" type="Zend\ServiceManager\ServiceManager" />

The next issue, I had and can't find the solution to fix it
 Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Magento\Framework\Setup\FilePermissions

Is there anyone know about this issue? Please let me know if you can fix it.
Thank you in advanced!


texts:
I'm having an issue with some translations in Magento 2 2.3.0. My store is in french, most of the text works fine.

It seems that the problem occurs only with content that come from JS (AJAX and template).

Example:
View and Edit Cart
I have the same problem with the state/province in the shipping calculation, it's in the wrong locale.

If I check in js-translation.json, there's around 300 translations and "View and Edit Cart" is one of them. I don't know where does these translations come from, my translation CSV has +9k terms.

I tried switching between dev and prod mode to see if the generation changed, but same thing.

Also, between every attempt, I ran these commands

rm -rf var/generation/* var/di/* var/cache/* var/page_cache/*
var/view_preprocessed/* pub/static/*;

bin/magento setup:upgrade;
bin/magento setup:di:compile;
bin/magento setup:static-content:deploy --theme=[my theme] fr_CA -f;
bin/magento cache:flush;
bin/magento indexer:reindex;

Magento: Community Edition 2.3.0
PHP: 7.2.13

Thank you


texts:
In content/page homepage I insert a widget from the porto theme:

{{block class="Smartwave\Filterproducts\Block\Home\LatestList" name="latest_product"
product_type="4" product_count="50" category_id="2" aspect_ratio="1" image_width="300" image_height="300"
template="grid.phtml"}}

The template file grid.phtml is in

app/design/frontend/Smartwave/porto/Smartwave_Filterproducts/templates/grid.phtml

I am modifying the product link so it opens in a new tab:

**Origin**
<a href="<?php echo $_product->getProductUrl() ?>" tabindex="-1">
**Modified**
<a href="<?php echo $_product->getProductUrl() ?>" tabindex="-1" target="_blank">

I then run the following commands from a bash script:

rm -rf ../var/* &&
rm -rf ../pub/static/ &&
php ../bin/magento setup:upgrade &&
php ../bin/magento setup:static-content:deploy en_GB en_US --theme  Smartwave/porto -f &&
chown -R muser:mgroup ../ &&
../bin/magento cache:flush &&
service varnish restart

However after that when I inspect the source code on the page where the widget is inserted the target="_blank" is still missing.

Is there something in the deployment that I forget?

I am on Magento 2.3.4 and the active theme is Smartwave/porto


texts: Magento2 plugin does not working on class Magento\OfflineShipping\Model\Carrier\Freeshipping

texts:
Create a plugin using for class Magento\OfflineShipping\Model\Carrier\Freeshipping. Use after method (afterCollectRates) for CollectRates function.

But this does not work

here  list of files:

app/code/AmitBera/CoreRewrite/etc/module.xml

code:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNameSpaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="AmitBera_CoreRewrite" setup_version="2.0.0">
        <sequence>
            <module name="Magento_Checkout"/>
            <module name="Magento_Sales"/>
            <module name="Magento_Quote"/>
            <module name="Magento_Vault"/>
            <module name="Magento_OfflineShipping"/>
        </sequence>
    </module>
</config>

app/code/AmitBera/CoreRewrite/etc/frontend/di.xml

code:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <type name="Magento\OfflineShipping\Model\Carrier\Freeshipping">
        <plugin name="disabledfreeShippingforfrontend" type="AmitBera\CoreRewrite\Model\Plugin\DisabledFreeShippingForFront" sortOrder="1" />
    </type>
</config>

app/code/AmitBera/CoreRewrite/Model/Plugin/DisabledFreeShippingForFront.php

code:

<?php
namespace AmitBera\CoreRewrite\Model\Plugin;
/**
* Disabled Freeshipping for frontend
*/
class DisabledFreeShippingForFront
{
    public function afterCollectRates(\Magento\OfflineShipping\Model\Carrier\Freeshipping $Freeshipping ,$result)
    {
        $this->_logger->debug(__METHOD__);
         return false;
    }

}

Also have the registration.php

Also i check the Limitations of plugin  from http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html

Does not find any final class at
Magento\OfflineShipping\Model\Carrier\Freeshipping
Does not find any final  Final classes

Now,Please let me know where i goes to wrong  except this two limited which limitation is create issue in my plugin


texts: Magento 2 Custom Module New Controller Issue

texts:
I have created listing & it's working fine with database.

Now i'm trying to create "Add Form" for that.

  {folder
  path}\magento2\app\code\Custom\Module\Controller\Adminhtml\Posts\NewAction.php

namespace Custom\Module\Controller\Adminhtml\Posts;

use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\App\Action\Context;

class NewAction extends \Magento\Framework\App\Action\Action {

    /**
     * @var \Magento\Framework\Controller\Result\ForwardFactory
     */
    protected $resultPageFactory;

    /**
     * @param \Magento\Framework\App\Action\Context $context
     * @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
     */
    public function __construct(
    \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        parent::__construct($context);
    }
    /**
     * {@inheritdoc}
     */
    protected function _isAllowed() {
        return $this->_authorization->isAllowed('Custom_Module::save');
    }

    /**
     * Forward to edit
     *
     * @return \Magento\Backend\Model\View\Result\Forward
     */
    public function execute() {
        /** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
        $resultForward = $this->resultForwardFactory->create();
        return $resultForward->forward('edit');
    }
}

It's giving below error.

  1 exception(s): Exception #0 (Exception): Recoverable Error: Argument
  1 passed to
  Custom\Module\Controller\Adminhtml\Posts\NewAction::__construct() must
  be an instance of Magento\Framework\App\Action\Context, none given,
  called in {folder
  path}\magento2\var\generation\Custom\Module\Controller\Adminhtml\Posts\NewAction\Interceptor.php
  on line 14 and defined in {folder
  path}\magento2\app\code\Custom\Module\Controller\Adminhtml\Posts\NewAction.php
  on line 20


texts: Magento 2 - On the frontend, how do I get a custom attribute I've added to the CMS page schema?

texts:
In Magento 2 I've added a custom attribute to CMS pages (another post on here got me part of the way).

I used UpgradeSchema.php to create the new attribute and I can see my new attribute/column in the cms_page table. I also created an Observer to add the field to CMS pages in Admin, and the field works (changes are saved) in the Admin > Content > Pages > Content tab.

This is where I've got stuck. I've got this far by piecing together bits and pieces of information I could find, but I can't find anything on how to actually 'get' this data and output it on the frontend.

At the moment I have an (empty) Helper, and a phtml template which is ready to output the value in. But I don't know what to put in the Helper, or even if that is the right thing to do (should I be extending the Page or Block class from example)?

As a lowly frontend developer trying to muddle his way through a Magento world, I could do with a little nudge in the right direction. Thanks.


texts: Price filter is not working in catalog search in magento 1.9

texts:
I am working on catalog search but on result page price filter in not working I have used following code on filter.phtml

    <?php foreach ($this->getItems() as $_item): ?>

            <?php if (($_item->getCount() > 0) && (strpos($_SERVER['REQUEST_URI'],'catalogsearch') === false)): ?>

            <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?>

            <?php

            elseif(strpos($_SERVER['REQUEST_URI'],'catalogsearch') == true): //afegitó

                $category = Mage::getResourceModel('catalog/category_collection')->addFieldToFilter('name', $_item->getLabel());

                $cat_det=$category->getData();

                $category_id=$cat_det[0][entity_id];

            ?>

            <a href="<?php echo $_SERVER['REQUEST_URI']?>&cat=<?php echo $category_id ?>"><?php echo $_item->getLabel() //afegitó ?>

            <?php else: echo $_item->getLabel() ?>

            <?php endif; ?>

            (<?php echo $_item->getCount() ?>)

    <?php endforeach ?>

And result is showing like this

Please anyone provide me solution..


texts:
I have migrated from Magento 1.x to Magento 2. Everything is working except that there are no customers displayed in the backend. I thought it might be some attribute that is loaded and nonexisting in my new installation, so I logged all SQL statements, but to problem is that there is no query that contains customer at all. If I click on the customer edit link on an order, it displays the customer edit page correctly. What could cause this problem and where can I start to dig deeper into this problem?

There are no errors logged and no (uncaught) exception occures. I also reindexed everything and cleared all caches.


texts: Use a custom variable in a category description

texts:
I recently created a custom variable named storecount - which I'll be programatically increasing for every store that is added to my store locator plugin.

I'd like to show this in various locations including product and category descriptions so when we do add a new store, we're not having to find every occurrence of the store count and manually increase it by 1.

Using {{customVar code=storecount}} doesn't work in category descriptions. Is there any way I can get this variable without hacking the Magento core to pieces?


texts:
I have been optimizng magento store and faced that there are around 148 scripts running when homepage is loading so I did default Magento bundle enabled and then total number of elements requesting the server were reduced to 24 but then the problem was the page size was increased to 3.44 MB which is huge so I disabled it
How can I optimize it???
I am done with default magento optimize tips
minify css js optimize image and flat category
alsp have installed magento extension
Defer JS


texts: Element 'handle': Character content other than white space is not allowed because the content type is 'element-only

texts:
Migration from Magento1 to Magento2 was done using the data migration tool successfully.

However, certain product pages end up throwing the exception as seen on the attached screenshot.

To isolate the issue, I did even disable the custom module created for data migration.


texts: Magento2 behind AWS load balancer too many redirect admin

texts:
I have install magento2 in AWS ec2 behind a load balancer . But when i try to access to login admin page i have error too many redirection
The problem is all solution i have fine not work .
I try all of this
php bin/magento config:set web/secure/use_in_adminhtml 1
php bin/magento config:set web/secure/use_in_frontend 1
php bin/magento config:set web/cookie/cookie_httponly 0

i try to put web/unsecure/base_url with a https
web/unsecure/base_url = https://example.com

i try too remove and add my domain name in this variable
web/cookie/cookie_domain NULL
web/cookie/cookie_domain https://example.com

i try to put this in my .htaccess
SetEnv X-Forwarded-Proto=https
SetEnv HTTPS=on

or
SetEnvIf X-Forwarded-Proto https HTTPS=on

i try too add on the index.php
$_SERVER['HTTPS']='on';

but i don't have mage::run
my index.php finish with this
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
$bootstrap->run($app);

my core_config_data look like this
0,web/cookie/cookie_httponly,0
0,web/secure/base_link_url,https://example.com
0,web/secure/base_url,https://example.com
0,web/secure/use_in_adminhtml,1
0,web/secure/use_in_frontend,1
0,web/seo/use_rewrites,1
0,web/unsecure/base_url,http://example.com


texts: Magento 2: How to create a customer custom attribute?

texts: What are steps to create a custom attribute for Customer entity in Magento 2?


texts: Magento 2.0.7 - Understanding the different block classes?

texts:
I refer to the docs at http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#xml-manage-ref-block saying that this is one of the params possible for that class. I put it into a referenced container and a block below this one is showing it's content but not the logo.

        <block class="Magento\Theme\Block\Html\Header\Logo" name="logo">
            <arguments>
                <argument name="logo_file" xsi:type="string">images/logo.png</argument>
            </arguments>
        </block>

Is there a way to show error messages about this?

Why is the argument not matching the functions in logo.php? It should be the way since the conventions in docs say that it should match the name of the arguments in a certain way.


texts: 503 error only when customer logs in (Magento 1.9.4.0)

texts:
Website works fine until a customer logs in and then they are presented with a 503 error when they browse to any category or product. The actual account page does appear fine once they are logged in.

Only way to rectify this is to clear the session cookies.
I haven't installed any extensions recently and I'm not sure how long this has been happening.

Nothing in the Apache logs.

In Configuration > Web > Session Cookie Management I have tried two sets of configs to no avail:

Cookie Life Time: 3600
Cookie Path: /
Cookie Domain : .mydomain.com (The dot prefix is important)
Use HTTP Only : No
Cookie Restriction Mode: No

Cookie Life Time: 3600
Cookie Path: <blank>
Cookie Domain : <blank>
Use HTTP Only : Yes
Cookie Restriction Mode: No

Is there anywhere else I need to look/check, I'm at my wits end.

  https://www.myshop.co.uk


texts: Magento 2.3.5 Categories Automatically Unassigned/Removed From The Product

texts:
After upgrading to the latest Magento 2.3.5,
Assigned categories have automatically removed from the product after sometime add/edit products.
Example:
I have assigned the following categories in one product.

After a few minutes, categories auto removed from assigned products.


texts: creating quote in magento open source version 2.0

texts: Looking for best method to create a quote in Magento Open Source version 2.0. What is best practice method for doing this?


texts: Table Rates not working with multiple website environment magento 2

texts:
Table rate not working with multiple website with catalog price scope
  set to global.

Also we have multiple currency setup website vise.

Magento version 2.3.3

There was two kind of issue.

1.if i set catalog price scope set to Website, currency conversion working fine but table rate not working and always apply default main website's table rates.

2.if i set catalog price scope set to Global , currency conversion not working but table rate working fine.


texts: Magento 2 - On save user insert to other table on database

texts:
I created a new tab on User edit, with a form

I want to save the data getting from the form the other table on Database (Ex: test_table) when I click on save user button, is there any method to do that?

I try to use events

XML:

<event name="customer_account_edited">
    <observer name="test_event" instance="Testing\Test\Observer\TestUserOnSave"/>
</event>

PHP (TestUserOnSave)

public function execute(Observer $observer){
   $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/logger.log');
   $logger = new \Zend\Log\Logger();
   $logger->addWriter($writer);
   $logger->info('test events');
}

But it's doesn't work, is there any solution?


texts: Category image for each subcategory in megamenu

texts: How can I add an image, like a thumbnail, for each subcategory in the mega menu. i have tried to upload an image in the content section of the category, but it shows in the category view page, and i tried in SW menu to put it in top block, but the block does not show at all. i need to show it in the menu on top of the category column. exactly similar to this example: https://snag.gy/iUE8uK.jpg. i am using magento 2.2.5, this is the website URL: belsuit.com


texts:
On my site at http://139.59.47.100/ ,anyother url(http://139.59.47.100/daily-deals) except the home page is coming fine but for the homepage,i am getting the error "unable to serialize value".I have tried several fixes available for this like clearing the cache,recompiling,re deploying static assets etc.

Below is the exact error message.

  {"0":"Unable to serialize value.","1":"#0 /var/www/html/vendor/magento/framework/App/PageCache/Kernel.php(153): Magento\Framework\Serialize\Serializer\Json->serialize(Array)\n#1 /var/www/html/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(96): Magento\Framework\App\PageCache\Kernel->process(Object(Magento\Framework\App\Response\Http\Interceptor))\n#2 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(146): Magento\PageCache\Model\Controller\Result\BuiltinPlugin->afterRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Magento\Framework\View\Result\Page\Interceptor), Object(Magento\Framework\App\Response\Http\Interceptor))\n#3 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))\n#4 /var/www/html/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)\n#5 /var/www/html/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))\n#6 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#7 /var/www/html/vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http\Interceptor->launch()\n#8 /var/www/html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#9 {main}","url":"/","script_name":"/index.php"}


texts:
I am looking for a way to get the discount percent of an order, possibly from the order class or the invoice class, it would be amazing if

$order->getDiscountPercent();

worked, but it doesn't, any ideas on how I can pull the discount percent from either the order class or the invoice class?


texts: I am facing the problem when I export the downloadable product in magento2 as CSV and importing the same product in magento2 it report the error that downloadable option is missing.


texts: Magento different onepage checkout first step (2 variants)

texts:
we noticed the strangest thing. Sometimes it seems like Magento 'forgets' the checkout as guest option ... (that I am sure of that is active, because it always is)

However, sometimes we only see 1 option (instead of 2) : the only button available is create an account

Is there something logical that I am missing?

And the strange thing is that the setting is enable guest checkout = yes


texts:
I have a product that has some custom options, one of them being a text area.

We're having an issue where it seems that Magento is getting rid of any leading or trailing line breaks that are entered in that text area.

Is this something that Magento does by defualt and something that I can disable?


texts: Rewrite catalog_category_tabs not working

texts:
Pretty sure I'm a HUGE noob (sorry).
So this is what I've got so far: app/code/local/Mage/ProductLogUpdate/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mage_ProductLogUpdate>
            <version>0.0.1</version>
        </Mage_ProductLogUpdate>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <catalog_category_tabs>Mage_ProductLogUpdate_Block_Catalog_Category_Tabs</catalog_category_tabs>
                </rewrite>
            </adminhtml>
        </blocks>
        <models>
            <mage_productlogupdate>
                <class>Mage_ProductLogUpdate_Model</class>
            </mage_productlogupdate>
        </models>
        <events>
            <catalog_product_save_after>
                <observers>
                    <mage_productlogupdate>
                        <class>mage_productlogupdate/observer</class>
                        <method>logUpdate</method>
                        <type>singleton</type>
                    </mage_productlogupdate>
                </observers>
            </catalog_product_save_after>
        </events>
    </global>
</config>

app/code/local/Mage/ProductLogUpdate/Block/Catalog/Category/Tabs.php:

<?php
class Mage_ProductLogUpdate_Block_Catalog_Category_Tabs extends Mage_Adminhtml_Block_Catalog_Category_Tabs {
    public function addTabsToCategory(){
        $this->addTab('idname', array(
                    'label'     => Mage::helper('catalog')->__('Tab name'),
                    'content'   => "
tasdf
"
            ));

        return parent::_prepareLayout();
    }
}

I used this model/observer from a tutorial to test if my code works
app/code/local/Mage/ProductLogUpdate/Model/Observer.php:

<?php
/* Our class name should follow the directory structure of our Observer.php model, starting from the namespace, replacing directory separators with underscores. The directory of ousr Observer.php is following:
 app/code/local/Mage/ProductLogUpdate/Model/Observer.php */
class Mage_ProductLogUpdate_Model_Observer{
    // Magento passes a Varien_Event_Observer object as the first parameter of dispatched events.
    public function logUpdate(Varien_Event_Observer $observer){
        // Retrieve the product being updated from the event observer
        $product = $observer->getEvent()->getProduct();
        // Write a new line to var/log/product-updates.log
        $name = $product->getName();
        $sku = $product->getSku();
        Mage::log("{$name} ({$sku}) updated", null, 'product-updates.log');
    }
}
?>

And ofcourse this file app/etc/modules/Mage_ProductLogUpdate.xml:

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

So I'm completely lost and don't know what to do, I can't even find a lot of information about this on google and stuff.
I'm trying to use this answer, but I just don't know how to implement his code.

EDIT:
Changed location names from app/code/Mage/ProductLogUpdate/.. to app/code/local/Mage/ProductLogUpdate/...
Sadly enough, my problem is still not fixed.

To be clear, I'm trying to add a custom tab here.


texts:
I must to export from another db and import into magento.
I must to insert or update products or customers.

I maked the import new products or customers. I can also update?

I have this code:

Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

Mage::getModel('catalog/product')->getDefaultAttributeSetId();

$product = Mage::getModel('catalog/product'); try{ $product ->setStoreId(1) ->setWebsiteIds(array(1)) [...] ) ->setCategoryIds(array(3, 10));

$product->save(); }

catch(Exception $e)

{ Mage::log($e->getMessage()); }

this code add a new product. Correct? If i want update and not add a new product? –


texts: Can anyone explain what is form component in magento 2?

texts:
I have a question that "What is form component?".

I just want post a form to URL (ex: localhost/admincustomer/processing) in admin without DataProvider, but it didn't. I don't need storage DB or add/edit DB, just post.

I'm using form component but it need DataProvider. Please help me!


texts:
Magento cache is used to speed up performance. The cached files is stored in var/cache.

My doubt is how cached files are retrieved and shown in frontend.


texts:
I'm facing issues while update language code for website.

<!doctype html>
<html lang="en">

I want to change it with en-GB. I've already locale setup with default configurations.

Any help would be appreciate.


texts:
I've seen quite a lot of modules where they'll display a grid, but above that will be a block (sometimes an encouragement to upgrade, sometimes some additional information for the user).

I would like to add an Adminhtml form there.

The form is complete, and the grid is complete, but I can't seem to find any sort of hook to include the form in the grid.

I've already tried overriding the getMainButtonsHtml() method, but that seems to put the block underneath the filters. Ideally it needs to be above the filters. Is there a similar function for the HTML above the filters?

My other option would be to create an additional block that gets initialised in the tab, this one would include the form and the grid; so instead of adding the form to the grid, I'd add both the form and the grid to a container element.

Is there another (cleaner) way to do this?


texts:
How to get the total no of products in our custom filters as below.

Desktops(54)

i believe its getSize(), but not sure where it is used in Magento2?

Is it from Magento\Catalog\Model\ResourceModel\Product\Collection??


texts: How can I create a pdf file with Product details and download it by clicking on download image in product list page in magento 2.Can anybody Help me on this.


texts: When click Image and show clicking Image in popup in magento 2

texts:
How to create, When click Image and show clicking Image in popup.
This is my code :-
echo ""?><img src="<?php echo $this->getMediaUrl() .'brand'. $data->getImage(); ?>" width="100px" height="100px" class="click-header">

JS Code :-

Out Put Show Blank :-

THANKS.


texts:
SOLVED - see my answer below.

I changed my theme and all pages showed only html without any styling. Then I ran sudo php bin/magento setup:static-content:deploy and after website doesnt work and every page shows HTTP ERROR 500.

Any idea what this error log below means?

nginx error log:

2017/01/25 16:10:44 [error] 1124#1124: *540 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/mg/var/page_cache" is not writable in /var/www/html/mg/vendor/magento/zendframework1/library/Zend/Cache.php:209
Stack trace:
#0 /var/www/html/mg/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...')
#1 /var/www/html/mg/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/html/m...')
#2 /var/www/html/mg/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array)
#3 /var/www/html/mg/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)
#4 /var/www/html/mg/vendor/magento/framework/App/Cache/Frontend/Factory.php(155): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true)
#5 /var/www/html/mg/vendor/magento/framework/App/Cache/Frontend/Pool.php(67): Magento\Fr" while reading response header from upstream, client: 127.0.0.1, server: edu.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "edu.dev"


texts: Magento 2 - How to remove unused javascript from product page

texts:
Currently magento 2 product page too slower in mobile device. Magento and theme make combined js file more than 1 MB. then we need to include some google analytics js, facebook pixel etc.

All these js making page slower because parsing time is too high. As per new google webmaster speed experimental, everyone need to optimize website.

Can anyone help to remove or reduce js size on product page?


texts: how to solved table catalog_product_entiry issue : M2

texts:
I found there is issue with row_id and entity_id in this catalog_product_entity.  I'm not able to assign product to category, it gives this error:

  Something went wrong while saving the category.SQLSTATE[23000]:
  Integrity constraint violation: 1452 Cannot add or update a child row:
  a foreign key constraint fails (mydb.catalog_category_product,
  CONSTRAINT CAT_CTGR_PRD_PRD_ID_SEQUENCE_PRD_SEQUENCE_VAL FOREIGN KEY
  (product_id) REFERENCES sequence_product (sequence_value) ON
  DELETE CA), query was: INSERT INTO catalog_category_product
  (category_id,product_id,position) VALUES (?, ?, ?), (?, ?, ?),
  (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?,
  ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?)

Table values in database is:


texts: 1.9.1 Swatch Icons - Display out-of-stock options

texts:
Using the new 1.9.1, my products have these sizes: S, M, L.

If say, M is out of stock, how can I display the M option but crossed out?

(1.9.1 seems to have the functionality built-in for when you have two options and the combination is out of stock).


texts: I have a css file in vendor/module/view/frontend/web/css/style.css in my own module but it is not working

texts:
I have a css file in web/css/style.css in my own module . but it is not working . i have called it in my vendor/module/view/frontend/layout/xmlfile .
Note : I don't want to add it in theme css i want to add it in my own module .

<head>
    <css src="Vendor_Module::css/style.css"/>
</head>


texts: Debugging Magento 2 css files in Chrome developer tools shows multiple css files

texts: I setup a custom theme based on Magento Blank theme. If I inspect the styles I see different css styles? I thought it should only show styles-l.css and style-m.css? Whats wrong here?


texts: How to create custom form in custom payment gateway ( Magento 2.3.5)

texts:
I'm new to Magento.
I expected to create custom form in my custom payment gateway, Text field and also Image uploader.

I had follow tutorial from magento :https://devdocs.magento.com/guides/v2.2/howdoi/checkout/checkout_payment.html

and Mageplaza: https://www.mageplaza.com/devdocs/magento-2-create-payment-method/.

Besides, i clone entire module from Github which from Mageplaza: https://github.com/mageplaza/magento-2-sample-payment-method

use exactly the same code, end up with

User frontend shown the option of my custom payment gateway,

User able to input the info.

But order on admin site doesn't show any custom info that user inputed.

Therefore, i worried is the input store in database?
Or storing in somewhere that i need to dig in?

thanks for help


texts: How to concatenate the success message in magento 2 in cart?

texts:
I created a module to alter the cart message.

  app\code\Eight25media\Changemsg\etc\frontend\events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_postdispatch_checkout_cart_add">
    <observer name="updatemessage" instance="Eight25media\Changemsg\Observer\UpdateCartSuccessMessage" />
</event>
</config>

  app\code\Eight25media\Changemsg\Observer\UpdateCartSuccessMessage.php

<?php

namespace Eight25media\Changemsg\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\RequestInterface;

class UpdateCartSuccessMessage implements ObserverInterface
{
/** @var \Magento\Framework\Message\ManagerInterface */
protected $messageManager;

/** @var \Magento\Framework\UrlInterface */
protected $url;

public function __construct(
    \Magento\Framework\Message\ManagerInterface $managerInterface,
    \Magento\Framework\UrlInterface $url
) {
    $this->messageManager = $managerInterface;
    $this->url = $url;
}

public function execute(\Magento\Framework\Event\Observer $observer) {
    $messageCollection = $this->messageManager->getMessages();
    $message = $messageCollection->getLastAddedMessage()->getText();

    $message = str_replace(' shopping', '', $message);
     $st = strpos($message, "don");
    $st1 = strpos($message, "have");
    if ($st !== false && $st1 !== false) {
        $cartLink = 'You can request a quote, continue shopping, or view your cart url->getUrl('checkout/cart') .'">here';
    }else{
        $cartLink = 'You can continue shopping or view your cart url->getUrl('checkout/cart') .'">here';
    }

    $this->messageManager->addSuccess($message . '  ' . $cartLink);
}
}

If i remove true in this line $messageCollection = $this->messageManager->getMessages(true); i am getting 3 messages like this image.where success message added in 2 different section. if i add true in this line $messageCollection = $this->messageManager->getMessages(true); i am getting the last latest last message only.

Before come to my last message i want to add the previous message also to the final message.How can i concatenate this message in this observer file.


texts: Change the UPS shipping label size in Magento CE

texts: Any ideas where and how I can change the size of the generated labels for UPS? We're getting giant labels that are unusable.


texts: Magento2 Visual Swatch : transparent image black background

texts:
Is anyone else having this issue, In visual swatch, I've uploaded transparent image and in frontend it showing like this?
Magento ver. 2.1.3


texts:
I am trying to do a mass export and found out that a module was causing an issue via system.log.

I removed the offending module via connect and double checked the usual places for any lingering files, but it looks to be removed. However, I am currently getting this error when running the export:

  2015-12-31T02:20:01+00:00 ERR (3): Warning:
  include(Ameex/Adminlog/Model/Observer.php): failed to open stream: No
  such file or directory  in
  /chroot/home/xx/xxx.com/html/lib/Varien/Autoload.php on line 94

  2015-12-31T02:20:01+00:00 ERR (3): Warning: include(): Failed opening
  'Ameex/Adminlog/Model/Observer.php' for inclusion
  (include_path='/chroot/home/xx/xxx.com/html/app/code/local:/chroot/home/rennraci/rennracing.com/html/app/code/community:/chroot/home/xx/xxx.com/html/app/code/core:/chroot/home/xx/xxx.com/html/lib:.:/opt/nexcess/php54u/root/usr/share/pear:/opt/nexcess/php54u/root/usr/share/php')
  in /chroot/home/xx/xxx.com/html/lib/Varien/Autoload.php on line 94

Ameex would be the offending module. So it would appear that something is trying to access the module even though it's removed.

Line 94 of Autoload.php is :         return include $classFile;

Anyway to disconnect the bad module?


texts: I apologize, if this is not the correct place to ask, but is there a place where I can describe my problem and people can suggest extensions (free or paid), that would help me. As I'm pretty sure it's illegal to advertise on stack.


texts: Magento 2 : Display log file information in an admin grid

texts:
Right now I'am logging a lot of informations about my webservices (duration , status , errorMessage)

And I want to display it in a grid Ui-component like , in an admin tab I already created.

How can I use something like the grid Ui-component to display my log info ?

Maybe it's not the best way to do it and you can help with another idea !


texts: Assigning customer to non-default group causes no products to be displayed

texts:
I don't know much about Magento but I've been tasked with writing a module at work. I've been testing it on a local Magento 1.8.1 install with almost completely default options. The time has come to move to integrating it with an existing Magento 1.8.0 setup. With this new setup, I'm encountering a problem that I never had in testing.

When I create a new customer group and assign customers to it, those customers then can't see any of the products that would be shown if they were in the default General group. For these custom group customers, I see no products in any category.

I've looked at all the likely options in the admin panel and searched around on the internet but I couldn't find anything. What could be the cause of the problem? Is it a config setting or a module they've installed or something else entirely?

Thanks, friends!


texts:
I am trying to write product data to a CSV file in order to export to a third party.

I need to break the operation down into chunks in order to prevent timeouts when writing large amounts of data.

The below code works but only writes the first 200 lines even though I have nearly 500 lines of products across three pages.

Does anyone know of a better way to do this?

Here is what I have so far:

public function uploadToApi()
{
    //Get the productIds
    $productIds = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('custom_attribute', 1)->addAttributeToFilter('type_id', array('eq' => 'simple'));

    if ($productIds > 0) {

        //Create the product.csv file
        $csvFilename = 'product.csv';
        $exportDir = Mage::getBaseDir() . '/var/modulefolder/' . $csvFilename;

        $offerPrice = Mage::getStoreConfigFlag('module/upload_settings/upload_to_api');

        //Need to get the stores
        $stores = Mage::app()->getStores();
        foreach ($stores as $key => $store) {

            $productIds->setPageSize(200);
            $pages = $productIds->getLastPageNumber();
            $currentPage = 1;

            //Unregister previously set shop_id
            Mage::unregister('shop_id');
            $storeId = $store->getId();

            //Create the array
            $products_row = array();
            $header = array('sku', 'product-id', 'product-id-type', 'price', 'discount-price', 'discount-from-date', 'discount-to-date', 'quantity', 'state');

            $products_row[] = $header; // CSV header

            $csv = new Varien_File_Csv();
            do {
                $productIds->setCurPage($currentPage);
                foreach ($productIds as $productId) {
                    $prod = $productId->setStoreId($storeId)->load($productId->getId());
                    $data['sku'] = $prod->getSku();
                    $data['product-id'] = $prod->getSku();
                    $data['product-id-type'] = 'SHOP_SKU';
                    $data['price'] = $oPrice ? $prod->getPrice() : null;
                    $data['discount-price'] = $prod->getAttributeText('special_sale_price') ? $prod->getSpecialPrice() : null;
                    $data['discount-from-date'] = $prod->getSpecialFromDate();
                    $data['discount-to-date'] = $prod->getSpecialToDate();
                    $data['quantity'] = round($prod->getStockItem()->getQty());
                    $data['state'] = '11';

                    $products_row[] = $data;

                }
                //Now set the shop_id to make the API call
                Mage::register('shop_id', $storeId);

                //write to csv file
                $csv->saveData($exportDir, $products_row);

                Mage::app()->setCurrentStore($store);
                $callApi = Mage::helper('marketplace/callapi');

                $currentPage++;

                $callApi->uploadOfferData();

                //Unset the array() after first loop
                unset($products_row);

                //clear collection and free memory
                $productIds->clear();
            } while ($currentPage <= $pages);
        }
    } else {
        Mage::log('Products : no product selection specified', null, '_errors.log', true);
    }

}

I'm trying to create the CSV for each store as the merchant has multi-website setup.

I'm trying to write 200 lines at a time to prevent a timeout issue if there are very large product collections but so far I only get 200 lines when I should get 500.


texts: Magento 1.9 - Customizations to Paypal Express Checkout not working

texts:
I am trying to customize the Magento Paypal Express Checkout functionality to pass the order total amount using current store's currency and rather than the base currency to Paypal. However, my customizations aren't appearing on the site.

Here is what I have created:

app/code/local/My/Paypal/Model/Express/Checkout.php

<?php

class My_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout {

    public function getCheckoutShortcutImageUrl() {
        //Copy pasted the original code with some modifications to use
        // _quote->getGrandTotal()
    }

    public function start($returnUrl, $cancelUrl, $button = null) {
        //Copy pasted original code with modifications to use
        //_quote->getGrandTotal() and _quote->getStoreCurrencyCode()
    }

}

?>

app/code/local/My/Paypal/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <My_Paypal>
      <version>0.1.0</version>
    </My_Paypal>
  </modules>
  <global>
    <models>
      <paypal>
        <rewrite>
          <express_checkout>My_Paypal_Model_Express_Checkout</express_checkout>
        </rewrite>
      </paypal>
    </models>
  <global>
</config>

app/etc/modules/My_Paypal.xml

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

I see my module showing up correctly under System -> Configuration -> Advanced -> Advanced -> Disable Modules Output as Enable, while Mage_Poll and Mage_Tag are showing up as Disable.

Directly changing Mage_Paypal_Model_Express_Checkout works, so I know my code changes work, but the correct way of customizing a model doesn't seem to work.

I refresh and flush the Magento cache with each change, so it's not just a caching issue.

My guess is that there is something wrong with my config.xml, but at this point I can't seem to figure out what.

Any ideas? Alternatively, a better way of achieving what I want to do would also work.

Also, how do I debug Magento to understand what may be erroring out in my customization? Are there logs I can turn on or look at?


texts: Magento 2 : How to change state list for USA?

texts:
How can I change/remove some states from Shopping Cart and Checkout page?

For example. I need to remove:

American Samoa;
Virgin Islands;
Armed Forces Africa (Americas, Canada, Europe, Middle East, Pacific);
etc


texts: How to add store address to invoice email

texts:
We would like to show the store's address at the top of the invoice email which is sent to customers when they place an order. Specifically, I would like to insert the value from the Invoice and Packing Slip Design section in the admin panel because this section can include the VAT number.

How can I insert the sales/identity/address value into a transactional email template? I have tried using the following variable but it comes out blank:

{{sales/identity/address}}


texts: Regarding to get the Customer Wishlist using SOAP Web Services

texts: Can I get the Customer Wishlist of Magento Store using SOAP web services?


texts: Magento 2.3.1 Vanilla Cron Error? Serialization failure: 1213 Deadlock found when trying to get lock

texts:
So we installed Magento 2.3.1 and some extensions. Nothing fancy. No data nothing. No errors until now.

Only every once per day we see the below error via our admin email. Can be any kind of job differs per day.

I am trying to understand why/how these jobs are leading to problems with cron if we arent really doing anything yet. This would appear a simple cron task to us.

How can we prevent this?

I dont believe truncating the tables is the solution as I have read somewhere ... I mean the error would just re-occur some days later.

In Mysql.php line 589:

  SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to
  get lock; try restarting transaction, query was: DELETE FROM `cron_schedule
  ` WHERE (status = 'missed') AND (job_code in ('the_job_code', 'ebizm
  arts_webhooks', 'jobs_clean_webhooks', 'jobs_clean_batches')) AND
   (created_at < '2019-04-18 04:06:05')

In Pdo.php line 235:

  SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to
  get lock; try restarting transaction, query was: DELETE FROM `cron_schedule
  ` WHERE (status = 'missed') AND (job_code in ('the_job_code', 'ebizm
  arts_webhooks', 'jobs_clean_webhooks', 'jobs_clean_batches')) AND
   (created_at < '2019-04-18 04:06:05')

In Pdo.php line 228:

  SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to
  get lock; try restarting transaction

cron:run [--group GROUP] [--bootstrap BOOTSTRAP]


texts: set custom attribute value according to product category in magento2

texts:
I want to show custom attribute value according to category I have two options in attribute yes/no in this I have to show yes for one category and no for another category like there are two categories sunglasses and glasses I have to set yes for glasses and no for sunglasses in magento2

like this, if option yes should be selected by default in glasses category products and no for sunglasses and attribute is coming on product page


texts: Can't save checkout custom fields in database

texts:
I'm able to add custom fields on checkout page and they are showing on checkout page now. However, the data entered into those fields is not saved into db after submitting the order.

I've followed below tutorial but still no luck.
https://oyenetwork.com/articles/magento2-devliery-date-module-creation-from-scratch/

Can someone help me to solve this problem?

FYI, I'm using Mageplaza's Onestepcheckout module on my website.

Thanks in advance!


texts:
I saw that in ce 1.9 this method appeared in the invoice model:

public function __construct()
{
    register_shutdown_function(array($this, 'destruct'));
    parent::__construct();
}

this meas the destruct method will be called when the execution ends, even if the page crashes for some reason.  In the destruct method the invoice is saved if _saveBeforeDestruct is set to true.
What I don't understand is the logic behind this.
let's say that _saveBeforeDestruct is set to true (this is set in the canVoid method), why do I need to save the invoice even if the script crashes?


texts: Sell free product with existing simple product

texts:
I'm integrating our magento 1.9.3.4 store with our inventory management system(cin7) and I'm trying to figure out how best to setup free products that sell automatically with existing simple products during regularly changing promotions.

About once a month 30+ products will offer a bonus product at no cost.

I could create a bundle product in magento or the inventory system but it would take a lot of time to manage them as I'd have to:

  create bundle product
  disable original product
  change bundle products sku/url to be the same as the original product so it continues to work with feeds/seo/etc.
  change all this back once the promotion is over

Ideally I'd attach the bonus product to an existing parent product at no cost and it wouldn't be seen anywhere but in the backend order view or the checkout/cart as a product line.

If anyone can suggest a good way to manage this I'd appreciate it, I'm hoping there is an extension that does this that I haven't been able to find. Or maybe there is a cleaner solution I haven't even considered.


texts: Hi there I changed cookie domain, which ovs typed in wrong. One article told me to remove it from PHPmyadmin but sitll cant login, I removed cookie sessions and everything


texts: Moving between classes from product info detailed to product-info-main Magento 2.0

texts:
I want to move the text from the "more information tab" which is in product info detailed, TO product-info-main under the SKU

So the info usually only seen by pressing the tab MORE INFORMATION is immediately shown.

Any idea's?


texts: Add an admin with basic custom form for Magento2

texts:
I am trying to create an admin page for my extension.
I managed to add a new button to the side menu just below the System icon by adding the following menu.xml under etc/adminhtml.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
    <menu>
        <add id="Test_Admin::adminpage" title="Test" module="Test_Admin" sortOrder="300" action="test/index" resource="Test_Admin::adminpage"/>
    </menu>
</config>

But I can't figure out how to route this button to a new page, this page should contain a form among other html.

In addition what is the way to create db-configs for my extension for the user to edit.


texts: Where is the code that calculates shipping from origin

texts: I need to find the code where the variable(s) of shipping origin location are declared and that calculates shipping rates so that I can create a module and manipulate the origin shipping address. Does anyone know where I can find this?


texts: Error while trying Schedule new Update for a Product

texts:
Trying  Schedule new update for a Product, I get this error after click Save:

  Error: : Something went wrong while saving the
  Magento\Catalog\Api\Data\ProductInterface.

I have 2 environments Stage and Production, only happening in Production.

Does anybody know this problem?


texts: How add simple product SKU to grouped products table?

texts:
How do you add the simple product sku to the grouped product table?

Basically, I want to remove the grouped product sku and add the sku's to each simple product that are listed in the grouped product table.  See the image below and the red drawing for a visual of what I am trying to accomplish:


texts: get tracking number in order history, how?

texts:
I have a carrier that get some info about orders from webservice and return a tracking number, I want to show this tracking number to customers in success page and also in order history

what function must use for this?

I used below functions but do not work

public function getTracking($trackings)
    {
        $authDetails = $this->_getAuthDetails();
        $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
        $order = Mage::getModel('sales/order')->load($orderId);
        $shippingId = $order->getShippingAddress()->getId();
        $address = Mage::getModel('sales/order_address')->load($shippingId);
        $firstname = $address->getFirstname();
        $lastname = $address->getLastname();
        $company = $address->getCompany();
        $jobTel = '0311';
        $homeTel = '0311';
        $mobile = '0913';
        $email = $address->getCustomerEmail();
        $street = $address->getStreetFull();
        $postcode = $address->getPostcode();
        $comment = 'for test';
        $regionId = $address->getRegion();
        $cityId = $address->getCity();
        $orders = '49^Windows Vista Home Edition^25000^100^1';
        $sendType = 0;
        $discount = 0;

        $getTracking = $authDetails->RegisterOrder($firstname,$lastname,$company,$jobTel,$homeTel,$mobile,$email,$street,$postcode,$comment,$regionId,$cityId,$orders,$sendType,$discount);
        //die(print ($getTracking));

        return $getTracking;
    }

    public function getTrackingInfo($tracking)
    {
        $info = array();

        $result = $this->getTracking($tracking);

        if($result instanceof Mage_Shipping_Model_Tracking_Result){
            if ($trackings = $result->getAllTrackings()) {
                return $trackings[0];
            }
        }
        elseif (is_string($result) && !empty($result)) {
            return $result;
        }

        return false;
    }


texts: Hide/Remove We can't find products matching the selection. message

texts:
How can I hide or remove this message
We can't find products matching the selection
It's appear on all pages
Magento version 2.3.3


texts: How to add google font in transactional email template Magento 1.9?

texts:
I'm new to magento and i have little problem with fonts. Is there a way to use some google fonts in my transactional emails template?
I've tried to use google font using below way

`@import url('https://fonts.googleapis.com/css?family=Rochester');`

in my email-inline.css file, but it does not work.

Any help would be appreciated.
Thanks in advance.


texts: get System configuration fields values - custom module

texts:
I have a module for Homepage Banner. I have stated two system config fields inside the module- etc/adminhtml/system.xml.

I need the values of these fields in frontend phtml file "view/frontend/templates/html/banner.phtml".

How will I get these system config fields('enable' and 'banner_content_type') values?


texts: follow-up question to "dirty playground" file in Magento 2

texts:
Based on this answer to a very similar question:
How can I bootstrap Magento 2 in a test.php script?, specifically https://magento.stackexchange.com/a/76382,

when I run php abstract.php, I get the following error:

  PHP Fatal error:  Interface 'Magento\Framework\AppInterface' not found in /var/www/html/scripts/abstract.php on line 14

It's probably very basic, please forgive me, but can anyone point me in the right direction?

scripts/abstract.php, from the above link, looks like

<?php
use \Magento\Framework\AppInterface as AppInterface;
use \Magento\Framework\App\Http as Http;

use Magento\Framework\ObjectManager\ConfigLoaderInterface;
use Magento\Framework\App\Request\Http as RequestHttp;
use Magento\Framework\App\Response\Http as ResponseHttp;
use Magento\Framework\Event;
use Magento\Framework\Filesystem;
use Magento\Framework\App\AreaList as AreaList;
use Magento\Framework\App\State as State;

abstract class AbstractApp implements AppInterface
{
    public function __construct(
        \Magento\Framework\ObjectManagerInterface $objectManager,
        Event\Manager $eventManager,
        AreaList $areaList,
        RequestHttp $request,
        ResponseHttp $response,
        ConfigLoaderInterface $configLoader,
        State $state,
        Filesystem $filesystem,
        \Magento\Framework\Registry $registry
    ) {
        $this->_objectManager = $objectManager;
        $this->_eventManager = $eventManager;
        $this->_areaList = $areaList;
        $this->_request = $request;
        $this->_response = $response;
        $this->_configLoader = $configLoader;
        $this->_state = $state;
        $this->_filesystem = $filesystem;
        $this->registry = $registry;
    }

    public function launch()
    {
        $this->run();
        return $this->_response;
    }

    abstract public function run();

    public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
    {
        return false;
    }
}


texts: Magento 1 : How to add multiple route in single Module

texts:
Below is the code for the router in config.xml

<routers>
    <representatives>
        <use>standard</use>
        <args>
            <module>Mage_Representatives</module>
            <frontName>dealer-questionnaire</frontName>
        </args>
    </representatives>
</routers>

I want to add one more route in this module how can I do that?


texts: Magento 1.9 calling getQuote function causing nesting level of '100' reached

texts:
I try to get the quote in a tax model class,but it start showing me the following error:

  Fatal error: Maximum function nesting level of '100' reached, aborting! in E:\wamp\www\lastposmogo\lib\Zend\Db\Adapter\Pdo\Abstract.php on line 292

I tried to increase xdebug.max_nesting_level = 200 but it doesn't work.

How can I resolve this issue?


texts: Unable to get a whole shipping address in magento2

texts:
I'm trying to get a shipping Address as whole like in the table sales_order_grid I had tried like below,

public function getordetails($orderid){
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $order = $objectManager->create('Magento\Sales\Model\Order')->load($orderid);

        $total = $order->getGrandTotal();

        $shippingAddress = $order->getShippingAddress();

        $shippingAddress = $order->getShippingAddress();

        $telephone = $shippingAddress->getTelephone();

        $address =  $shippingAddress->getStreet();

        $city = $shippingAddress->getCity();

        return $address;

    }

But here only able to get separated.. Is anyother way to get a like a whole address like in the table sale_order_grid  Please Anyone help me Thanks in Advance.


texts: Magento: shipping_tablerate table in db is empty after importing tables from backend

texts:
shipment method extensions based on table rates like Matrixrates won't show in frontend. i disabled other extensions but nothing changed. no log and no error. i checked out shipping_tablerate table in database and it was empty. and nothing added after reimporting data.

this is one line of tablerate.csv that i am trying to import to the Matrixrates:

Country,Region/State,City,"Zip/Postal Code From","Zip/Postal Code To","Weight From","Weight To","Shipping Price","Delivery Type"
IRN,*,*,1199000000,1911000000,1,5.9999,11000,Iran Post


texts: Magento 2.1 Product Sorting Alter name and price with asc and desc option

texts:
File path:
app/design/frontend/<vendor_name>/<theme_name>/Magento_Catalog/templates/product/list/toolbar/sorter.phtml

I want to alter Sorting options as

Name to Alphabets ASC, Alphabets DESC
Price to Price highest First , Price Lowest First

I have tried below solution :
<option value="<?php echo 'name&product_list_dir=asc'; ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>>
    <?php echo $block->escapeHtml(__("Alphabetical A-Z")) ?>
</option>

<option value="<?php echo 'name&product_list_dir=desc'; ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
    <?php echo $block->escapeHtml(__("Alphabetical Z-A")) ?>
</option>

Issue:   When ajax is being called URL created like this -
?product_list_order=price%26product_list_dir%3Ddesc` instead of `?product_list_order=price&product_list_dir=desc


texts: How to use descending order in sort By created date

texts:
I followed First answer on this page, it is working fine.

app/etc/modules/Stackoverflow_Catalog.xml

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

app/code/local/Stackoverflow/Catalog/etc/config.xml

<?xml version="1.0"?>
<config>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <config>Stackoverflow_Catalog_Model_Config</config>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

app/code/local/Stackoverflow/Catalog/Model/Config.php

<?php

class Stackoverflow_Catalog_Model_Config extends Mage_Catalog_Model_Config {
    public function getAttributeUsedForSortByArray() {
        $options = parent::getAttributeUsedForSortByArray();
        if (!isset($options['created_at'])) {
            $options['created_at'] = Mage::helper('catalog')->__('Date');
        }
        return $options;
    }
}

but I want new products to show first, I mean Descending order, Please Let me know if any one has solution


texts: How to add a custom product to cart using PHP

texts:
Please bear with me, I'm new to Magento and PHP.

I've been looking for hours for this but unfortunately I cannot make it to work. All other questions made didn't explained where to get the variables.

Can someone explain to me how to get this working?
I don't know which parameters to pass to the code to add the product to the cart...

What I need to do is to include a custom product to the cart after a person chose it from different options on a form. I have the form working.

I guess I need to modify the code below with ID's and such, but I have no idea where to get the data I need to fill in...

// Add a product (simple); id:12,  qty: 1
$cart->addProduct(12, 1);

// Add a product with custom options
$productInstance = Mage::getModel('catalog/product')->load($productId);
$param = array(
    'product' => $productInstance->getId(),
    'qty' => 1,
    'options' => array(
        234 => 'A value'  // Custom option with id: 234
    )
);

This is what I have:

require_once '../app/Mage.php';

umask(0);
Mage::init('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));

// Get customer session
$session = Mage::getSingleton('customer/session');

// Get cart instance
$cart = Mage::getSingleton('checkout/cart');
$cart->init();

// Add a product (simple); id:12,  qty: 1
$cart->addProduct(12, 1);

// Add a product with custom options
$productInstance = Mage::getModel('catalog/product')->load($productId);
$param = array(
    'product' => $productInstance->getId(),
    'qty' => 1,
    'options' => array(
        234 => 'A value'  // Custom option with id: 234
    )
);
$request = new Varien_Object();
$request->setData($param);
$cart->addProduct($productInstance, $request);

// Set shipping method
$quote = $cart->getQuote();
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setShippingMethod('flatrate_flatrate')->save();

// update session
$session->setCartWasUpdated(true);

// save the cart
$cart->save();

---Edit---

This is the message I get:

Fatal error: Uncaught exception 'Mage_Core_Exception' with message 'Please specify the product required option(s).' in C:\xampp\htdocs\inc\app\Mage.php:595 Stack trace: #0 C:\xampp\htdocs\inc\app\code\core\Mage\Checkout\Model\Cart.php(284): Mage::throwException('Please specify ...') #1 C:\xampp\htdocs\inc\mixform\form.php(71): Mage_Checkout_Model_Cart->addProduct(Object(Mage_Catalog_Model_Product), Array) #2 {main} thrown in C:\xampp\htdocs\inc\app\Mage.php on line 595


texts: How to limit the results from a Left Join in Magento?

texts:
I have a collection that I need to join with another collection... the problem is the table contains 125k rows and so it times out.

        //Fields
        $this->addFieldToSelect('id');
        $this->addFieldToSelect('subject');
        $this->addFieldToSelect('email_address');
        $this->addFieldToSelect('mail_id');
        $this->addFieldToSelect('date_sent');
        $this->addFieldToSelect('customer_id');

        //Get latest status
        $this->getSelect()->joinLeft(
            array('me1' => Mage::getResourceModel('someprovider_mail/event')->getMainTable()),
            'main_table.id = me1.email_id',
            'event_type as current_status'
        );

       $this->getSelect()->joinLeft(
            array('me2' => Mage::getResourceModel('someprovider_mail/event')->getMainTable()),
            '(main_table.id = me2.email_id AND (me1.timestamp < me2.timestamp OR me1.timestamp = me2.timestamp AND me1.id < me2.id))',
            false
        );

So I need to limit just what comes back in the joinLeft()... how is that possible?


texts: Product's Custom Attribute ISN'T updating on the ADMIN PAGE

texts:
I'm beginner at Magento 2 and i'm trying to update an attribute value from a specific product.
The update works on the API, but seems to have not updated on the admin page. What could it be? Any help is useful.


texts: Moved the billing address form to the shipping address page in the checkout on Magento 2.3.5, but billing address entry is optional now?

texts:
Following this method allowed the billing address form to be added to the shipping address page, but entry of a billing address is optional.
What I mean is, if the Next button is pressed on the page without entering any billing address details, the browser would still proceed onto the next page.
If I click Update button inside the billing form while nothing is entered, messages in red color are shown under appropriate fields, but clicking the Next button bellow lets the browser to proceed onto the next page.
How do I make entry of the billing address on the page to be required ? I want, if the Next button is pressed without a billing address entered, messages in red color to appear under applicable fields, and the browser not to proceed onto the next page until the billing address is entered and Next is clicked again.
p.s. "My billing and shipping address are the same" is not ticked.


texts: Magento 2: The requested component ("int") is not found. Before using, you must add the implementation

texts:
I am getting this following error while editing the product. This issue occurred after sync the products from Akeneo to Magento using Pimgento 2 API.

Issue: The requested component ("int") is not found. Before using, you must add the implementation.

Environment:
Magento CE 2.1.9, Akeneo CE 2.3, PHP 7, Mysql 5.7.25

Steps to reproduce

Sync products from Akeneo to Magento using Pimgento 2 API
After sync try to edit products, it throws an error

Expected results

I should be able to edit the product in admin grid.

Actual results

The requested component ("int") is not found. Before using, you must add the implementation.


texts:
I have Magento 2.3.
Cookie Restriction mode is enabled in the admin panel but not showing on the home page.
the style after load page [display is none ]  but the style on CSS  [display is block]

this image from css theme

and this image after load page

i flushed all cache but not working. how can i solve this


texts:
Considering this layout update XML:

<?xml version="1.0"?>
<layout version="0.0.1">
    <checkout_cart_index>
        <reference name="methods">
            <block type="mhquote/request_link" name="mhquote.request.link" as="mhquoteRequestLink" before="-" template="mhquote/request/link.phtml" />
            <remove name="checkout.cart.methods.onepage" />
            <remove name="checkout.cart.methods.multishipping" />
        </reference>
    </checkout_cart_index>
</layout>

When the update is applied the cart page goes from this:

To this:

I can't understand why the new block is not shown, given that:

a module exists which has mhquote as a unique handler
the module is correctly set as for controllers in it work fine
methods block is a core/text_list block, so it should automatically render all child blocks
the template exists at app/design/frontend/<current_theme>/default/template/mhquote/request/link.phtml
the Disc_Quote_Block_Request_Link block class exists and extends from Mage_Core_Block_Template, Disc_Quote being the class group handled by mhquote
the layout update file is loaded correctly as it successfully removes the two checkout links

The block template is really simple, just a
 with a string I'd like to show:

Hello

I can't see where I'm wrong. I keep checking and rewriting it from scratch paying more attention to the namings but I can't seem to show that block.

Any idea why? Thanks in advance for your help.

=== EDIT 1 ===

This is the config.xml for the module:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Disc_Quote>
            <version>0.0.1</version>
        </Disc_Quote>
    </modules>

    <global>
        <blocks>
            <mhquote>
                <class>Disc_Quote_Block</class>
            </mhquote>
        </blocks>
        <helpers>
            <mhquote>
                <class>Disc_Quote_Helper</class>
            </mhquote>
        </helpers>
        <models>
            <mhquote>
                <class>Disc_Quote_Model</class>
            </mhquote>
        </models>
    </global>

    <frontend>
        <routers>
            <mhquote>
                <use>standard</use>
                <args>
                    <module>Disc_Quote</module>
                    <frontName>mhquote</frontName>
                </args>
            </mhquote>
        </routers>

        <layout>
            <updates>
                <mhquote>
                    <file>mhquote.xml</file>
                </mhquote>
            </updates>
        </layout>
    </frontend>

</config>


texts: Custom Checkout Validation - Two fields must have the same value : M2

texts:
I have read  this URL for equalTo validation.

I have add custom field using LayoutProcessor.php file and set validation like this :

'validation' => ['validate-no-empty' => false,'validate-password' => true,'min_text_length' => 7, 'max_text_length' => 20,],

all above validation is working good except "equalTo".

I have try like this: , "equalTo" => "#fieldname" but still not working, can anyone help me, how can i use "equalTo" validation in LayoutProcessor.php file?

My Code:

<?php
namespace Packeg\Modulename\Plugin\Checkout\Model\Checkout;

class LayoutProcessor
{

    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array  $jsLayout
    ) {

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customerSession = $objectManager->get('Magento\Customer\Model\Session');
        if(!$customerSession->isLoggedIn()) {

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['before-shipping-method-form']['children']['password_1'] = [
            'component' => 'Magento_Ui/js/form/element/abstract',
            'config' => [
                'customScope' => 'shippingAddress',
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/password',
                'id' => 'password_1'
            ],
            'dataScope' => 'shippingAddress.password_1',
            'label' => 'Create Password',
            'provider' => 'checkoutProvider',
            'visible' => true,
            'validation' => ['validate-no-empty' => false,'validate-password' => true,'min_text_length' => 7, 'max_text_length' => 20,],
            'sortOrder' => 250,
            'id' => 'password_1'
        ];

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['before-shipping-method-form']['children']['password_2'] = [
            'component' => 'Magento_Ui/js/form/element/abstract',
            'config' => [
                'customScope' => 'shippingAddress',
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/password',
                'id' => 'password_2'
            ],
            'dataScope' => 'shippingAddress.password_2',
            'label' => 'Re-enter Password',
            'provider' => 'checkoutProvider',
            'visible' => true,
            'validation' => ['validate-no-empty' => true, 'validate-password2'=> true , "min_text_length" => 7, "max_text_length" => 20],
            'sortOrder' => 255,
            'id' => 'password_2'
        ];

    }
        return $jsLayout;
    }
}


texts:
[I have changed some file permission
Now my website is giving me error
we can 't read some files that are required to run the Magento application. This usually means file permissions are set incorrectly.

When I run php bin/magento cache:clean

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Serialize\SerializerInterface in /var/www/html/magento211/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
Stack trace:
#0 /var/www/html/magento211/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#1 /var/www/html/magento211/vendor/magento/framework/ObjectManager/Config/Config.php(345): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#2 /var/www/html/magento211/vendor/magento/framework/ObjectManager/Config/Config.php(276): Magento\Framework\ObjectManager\Config\Config->getSerializer()
#3 /var/www/html/magento211/vendor/magento/framework/ObjectManager/ObjectManager.php(84): Magento\Framework\ObjectManager\Config\Config->extend(Array)
#4 /var/www/html/magento211/vendor/magento/framework/App/ObjectManager/Environment/Developer.php(79): Magento\Framework\ObjectManager\ObjectManager->configure(Array)
#5  in /var/www/html/magento211/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

Pic of My file permission


texts: Create quote with product options programmatically

texts:
i created a product with customizable options like this:

and i've successfully create a quote like this:

$store = $this->storeManager->getStore();
$websiteId = $this->storeManager->getStore()->getWebsiteId();
$customer = $this->_customerFactory->create();
$customer->setWebsiteId($websiteId);
$customer->loadByEmail($email);
$quote = $this->quote->create();
$quote->setStore($store);
$customer = $this->_customerRepoInterface->getById($customer->getEntityId());
$quote->setCurrency();
$quote->assignCustomer($customer);

foreach ($productsOrder as $productOrder) {
  $productId = $productOrder['product_id'];
  $qty = $productOrder['qty'];
  $product = $this->_product->load($productId);
  $price = $product->getPrice();
  $product->setPrice($price);
  $quote->addProduct(
      $product,
      intval($qty)
    );
}

$quote->getBillingAddress()->addData($address);
$quote->getShippingAddress()->addData($address);

$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCollectShippingRates(true)
  ->collectShippingRates()
  ->setShippingMethod($shippingMethod);
$quote->setPaymentMethod($paymentMethod);
$quote->setInventoryProcessed(false);
$quote->save();

I need to insert the product customizable options value when i create the quote, but how to do it?


texts:
I need customers to be able to switch on/off products to buy within their "My Cart" listing page (By default Magento let customers only remove items from the cart).

Is there a method or an extension to achieve this result? I'am attaching a picture as an example of what I need.


texts: Magento Add value in custom column of sales_flat_order table

texts:
Hi i have made a custom column in sales_flat_order table named final_shipping_amount. When i am loading order its showing my custom column in it. I am trying to add value in my custom column but its not adding value in it here is my code.

$final_shipping = "1.33"
$orderIid = $this->getRequest()->getParam('id');
$orderDataShip = Mage::getModel('sales/order')->load($orderIid);
$orderDataShip->setFinalShippingAmount($final_shipping);
$orderDataShip->save();

Its not saving value in it. i have also tried this way but also its not saving

$final_shipping = "1.33"
$orderIid = $this->getRequest()->getParam('id');
$orderDataShip = Mage::getModel('sales/order')->load($orderIid);
$orderDataShip->setData('final_shipping_amount' , $final_shipping);
$orderDataShip->save();

but its not working.


texts: Magento 2: Send Email with CSV attachment

texts:
How to send the simple mail with CSV attachment file in Magento 2.

Please help me to solve out this Question.

Thanks in Advanced.


texts:
I cannot seem to find an answer for this anywhere! I am trying to make a custom theme based on the bootstrapped theme, and I cannot find anywhere how to simply list the categories!

I've tried basing it off the modern theme with topmenu.phtml which has this line:

$this->getHtml('level-top')

But I cannot find level-top anywhere?

How can I just list the categories with their sub-categories in my theme?

Category2

Sub-Category

Sub-Category

On a side note, why is the magento theme system designed in the way it is? It's vile!
What is with including CSS and JS and pages via an XML file? Magento is slow as hell already why on earth use XML?


texts:
Modifying product page I have encountered some methods touching stock and product availibility:

$_product->isSaleable());
$_product->isSalable());
$_product->isAvailable());
$_product->isInStock());

Can someone compare their functionality and add some hints when any of them should be used? If there are any method more which can be misunderstood like them, please add them in comments.


texts: how to send ajax request in magento 2 by using ajax request inside a javascript function?

texts: I want to send ajax request in javascript function. how to send the ajax request calling a javascript function in magento 2?


texts: Grid Page for custom collection in Front end

texts:
We have a marketplace website, where we have list of vendors.

In a page, we need to list all vendors for customers, So that customers can search and filter by Vendor's group, name, location. It would reflect nearly the Grid pages in admin.

We have custom collection for it. But to display as searchable by every column for the customer has to be made.

I tried like grid making in Backend,here is the Block I'm using

<?php
class Probytes_Customization_Block_Listvendors extends VES_Vendors_Block_Adminhtml_Vendors_Grid {
    public function __construct()
    {
        $this->_blockGroup = 'customization_listvendors';
        $this->_controller = 'customization_listvendors_index';
        $this->_headerText = Mage::helper('customization')->__('Orders - Inchoo');

        parent::__construct();
    }
    protected function _prepareCollection() {
        $collection = Mage::getModel('vendors/vendor')->getCollection()
                        //->addNameToSelect()
                        ->addAttributeToSelect('telephone')
                        ->addAttributeToSelect('postcode')
                        ->addAttributeToSelect('country_id')
                        ->addAttributeToSelect('group_id')
                        ->addAttributeToSelect('firstname')
                        ->addAttributeToSelect('lastname')
                        ;
      //$collection->getSelect()->columns('CONCAT(firstname,lansname) as name');
      $this->setCollection($collection);
      return parent::_prepareCollection();
    }
    protected function _prepareColumns()
  {

      $this->addColumn('entity_id', array(
          'header'    => Mage::helper('vendors')->__('ID'),
          'align'     =>'right',
          'width'     => '50px',
          'index'     => 'entity_id',
      ));

      $this->addColumn('vendor_id', array(
          'header'    => Mage::helper('vendors')->__('Vendor'),
          'align'     =>'left',
          'width'     => '150px',
          'index'     => 'vendor_id',
      ));

      $this->addColumn('firstname', array(
          'header'    => Mage::helper('vendors')->__('First Name'),
          'align'     =>'left',
          'width'     => '150px',
          'index'     => 'firstname',
      ));

      $this->addColumn('lastname', array(
          'header'    => Mage::helper('vendors')->__('Last Name'),
          'align'     =>'left',
          'width'     => '150px',
          'index'     => 'lastname',
      ));

      $this->addColumn('group_id', array(
          'header'    => Mage::helper('vendors')->__('Group'),
          'align'     =>'left',
          'width'     => '150px',
          'type'      => 'options',
          'options'   => Mage::getModel('vendors/source_group')->getOptionArray(),
          'index'     => 'group_id',
      ));
      return parent::_prepareColumns();
  }
}

Then in the controller

public function indexAction() {
        $this->loadLayout();
        $this->getResponse()->setBody(
            $this->getLayout()->createBlock('customization/listvendors')->toHtml()
        );
        //$this->renderLayout();
    }

How to implement it in front end?


texts: Adding Product Backend URLs on the Custom Grid

texts:
I have a custom grid, where I need to add links to Product Edit pages on back-end.
I was able to get product front-end URLs using  a renderer, but can't get the product links on back-end.

I have tried this code, but it redirects to the "Manage products" page instead of that particular product and I'm getting an error "This product no longer exists".

$this->addColumn('action', array(
    'header'    => Mage::helper('catalog')->__('Action'),
    'width'     => '50px',
    'type'      => 'action',
    'getter'    => 'getId',
    'actions'   => array(
        array(
            'caption' => Mage::helper('catalog')->__('Product Backend Url'),
            'url'     => array(
                'base'    => 'adminhtml/catalog_product/edit/productcomment_increment_id/',
                'params'  => array('store'=>$this->getRequest()->getParam('entity_id'))
            ),
            'field'   => 'id'
        )
    ),
    'filter'    => false,
    'sortable'  => false,
    'index'     => 'stores',
));

How can I get the product edit page URLs on the back-end?
Thanks for help in advance.


texts: How do I create a link to a product using just the ID or SKU?

texts:
I am using the products API (rest/V1/products/:sku) and getting back an id for a product.

I'd like to use that to build a URL to the product page - something like

http://my-store.com/index.php/catalog/product/view/id/:id

What is the correct URL?

Note: Direct link to a category works properly:

http://my-store.com/index.php/catalog/category/view/id/:id

One of the custom_attributes returned by the products API is url_key, but I can't seem to get that to work either:

[10] => stdClass Object
                (
                    [attribute_code] => url_key
                    [value] => zoltan-gym-tee-l-blue
                )

http://my-store.com/zoltan-gym-tee-l-blue doesn't work (with or without .html suffix).

I wonder if this is a bug in the products API, because the real url key does not include attribute information - i.e., the URL

http://my-store.com/zoltan-gym-tee.html  does work.  (But note that this is not the URL key - the url key is "zoltan-gym-tee-l-blue".)


texts: Magento2 - Loading different modules per environment

texts:
Is there currently a way to load different modules per environment, for instance to load Alan's CommerceBug extension only when I'm in my development environment?

Like in Magento 1 I can .gitignore the modules files in app/code but I can not ignore changes to app/etc/config.php easily via git.

It does not seem possible to load modules defined in your env.php as the Magento\Framework\App\DeploymentConfig\Reader load method only uses array_merge, instead of some sort of deep merge, to merge the file data and throws an Exception if similar keys are found.

/**
 * Loads the configuration file
 *
 * @param string $fileKey
 * @return array
 * @throws \Exception
 */
public function load($fileKey = null)
{
    $path = $this->dirList->getPath(DirectoryList::CONFIG);
    $fileDriver = $this->driverPool->getDriver(DriverPool::FILE);
    $result = [];
    if ($fileKey) {
        $filePath = $path . '/' . $this->configFilePool->getPath($fileKey);
        if ($fileDriver->isExists($filePath)) {
            $result = include $filePath;
        }
    } else {
        $configFiles = $this->configFilePool->getPaths();
        $allFilesData = [];
        $result = [];
        foreach (array_keys($configFiles) as $fileKey) {
            $configFile = $path . '/' . $this->configFilePool->getPath($fileKey);
            if ($fileDriver->isExists($configFile)) {
                $fileData = include $configFile;
            } else {
                continue;
            }
            $allFilesData[$configFile] = $fileData;
            if (!empty($fileData)) {
                $intersection = array_intersect_key($result, $fileData);
                if (!empty($intersection)) {
                    $displayMessage = $this->findFilesWithKeys(array_keys($intersection), $allFilesData);
                    throw new \Exception(
                        "Key collision! The following keys occur in multiple config files:"
                        . PHP_EOL . $displayMessage
                    );
                }
                $result = array_merge($result, $fileData);
            }
        }
    }
    return $result ?: [];
}

I found a very early github issue raised by @mzeis on https://github.com/magento/magento2/issues/7 which talks about multiple configurations per environments but this has been closed.

It would be possible to do some git hooks which call bin/magento module:enable and module:disable but this seems a very roundabout way to achieve truly environment dependant configuration.


texts: Magento2 - Customize Order Numbers - Overriding: Magento\SalesSequence\Model\Sequence

texts:
Magento 2 is using the class Magento\SalesSequence\Model\Sequence to generate a reserved order number prior to actually placing an order. I would like to override this class to create custom increment numbers but the fact that the variables are private prevents the subclass from accessing them.

As suggested on Mage2.pro, having the properties declared as protected instead would be simpler.

Not Conceivable Solutions

Editing Core Files

I'm able to achieve my goal by directly editing the core file Magento\SalesSequence\Model\Sequence – which is of course not the solution I'm looking for.

Observers

I'm aware that it is possible to use observer to set the order number later in the process but I imperatively need the order number to be set when initially reserved as other extensions will be relying on it.

Plugins [UPDATE]

Using an after plugin on the getCurrentValue() function, I am able to retrieve the system generated number and entirely control the returned number. This would work perfectly if I would be able to access the meta variable to identify for which entity_type the function is currently executed. Still, this variable is private and therefore inaccessible.

Online Information

At the time of writing, I was not able to find any useful information online related to this new method used by Magento 2 for assigning order numbers. Everything seems to be build so that Prefixes, Suffixes and even the pattern can be changed easily but nothing is integrated within the Community Edition admin interface.

Important Note

I'm looking for a solution which will allow to add dynamic information to the resulting order number, not simply static Prefixes or Suffixes added through the sales_sequence_profile database table.

Different Entity Types

Also the Sequence class is used for generating different numbers for different entity_type as invoice, creditmemo and shipment based on the data stored in the sales_sequence_meta database table. This means that the method responsible for dynamically creating new numbers must have access to this sequence meta to identify for which entity type it is currently creating a number allowing it to be adapted in consequence.

Indications from someone who was able to achieve this goal would be very appreciated!

Any suggestion is welcomed!


texts: i cant Indexed category/products association in magento 1.9.2.4

texts:
Hi maybe someone can help me I’m having a problem with Indexed category/products association i try just about everything people say and it’s not working  this is what I did so far and not working

System -> Configuration > Manage Stores > the Store Name click on Main Website Store. >Default Category

It’s on the right one and I redo it just to make sure
i also try to change the permission set to tmp folder.  /var/locks  from 777 to 755 and still not working

Does anyone have any more ideas that I can fix this problem??

Thank you
  Danny


texts: API - How to get Product or Category by url/path?

texts:
I'm working on an Angular 2 App in front of Magento2 and I would like to get URL Info to know where to go in my App and what to load.
We already have many Angular 1 Apps working like that with Drupal (in API mode), I would like to do the same with Magento 2 API.

Thank you for any answer/feedback.


texts: Magento 2.3: How can I get the customer ID with PHP?

texts:
I am trying to get the items of the cart as well as the customer ID in my Module. But the problem is that I don't know how to get the customer ID properly.

In the Moment I have this Code and it works:

<?php
// Get all items in cart
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');

// retrieve quote items collection
$itemsCollection = $cart->getQuote()->getItemsCollection();

// get array of all items what can be display directly
$itemsVisible = $cart->getQuote()->getAllVisibleItems();

// retrieve quote items array
$items = $cart->getQuote()->getAllItems();

foreach($items as $item) {
    echo 'ID: '.$item->getProductId().'
';
    echo 'Name: '.$item->getName().'
';
    echo 'Sku: '.$item->getSku().'
';
    echo 'Quantity: '.$item->getQty().'
';
    echo 'Price: '.$item->getPrice().'
';
    echo "
";
}

Now, what do I need to add to get the Customer ID?


texts:
I am having a problem with the speed of the website. I dont know for sure where the problem is, even gtmetrix gets an error while analyzing it. Does anyone know how I can solve this? This is the link to my site: https://goo.gl/yCbPPM

Thanks!


texts: Magento 2 : How to check customer first order?

texts:
How to check if customer with first order or not for login and guest users?
What is the proper way to check if customer is first time placed an order?


texts: how to get the option label instead of option value in magento admin panel grid?

texts:
I am rewriting the magento admin panel grid for low stack products.
In that I have added the new column color in the grid.But this column shows the attribute value instead of showing label.
Below is my code which I added in grid.php

$this->addColumn('color', array(
    'header'    => Mage::helper('reports')->__('Product Color'),
    'sortable'  => false,
    'index'     => 'color',
    'type'      => 'options',
));

and below is the default collection in grid.php file.I didn't do anything in the collection.

$collection = Mage::getResourceModel('reports/product_lowstock_collection')
            ->addAttributeToSelect('*')
            ->setStoreId($storeId)
            ->filterByIsQtyProductTypes()
            ->joinInventoryItem('qty')
            ->useManageStockFilter($storeId)
            ->useNotifyStockQtyFilter($storeId)
            ->setOrder('qty', Varien_Data_Collection::SORT_ORDER_ASC);

I am not sure if I have to do something in this collection.

Thanks,