texts: Custom template for shipping method item

texts:
I need to create a custom template for shipping method item

  view/frontend/web/template/shipping-address/shipping-method-item.html

However, this template file has allready been overwritten by another module, so this method is not working.

<item name="shipping-step" xsi:type="array">
    <item name="children" xsi:type="array">
        <item name="shippingAddress" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="shippingMethodItemTemplate" xsi:type="string">DM_Checkout/shipping-method-item</item>
            </item>
        </item>
    </item>
</item>

The other module looks like this:

  vendor/quickpay/magento2/view/frontend/layout/checkout_index_index.xml

<item name="shipping-step" xsi:type="array">
    <item name="children" xsi:type="array">
        <item name="shippingAddress" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="shippingMethodItemTemplate" xsi:type="string">QuickPay_Gateway/shipping/shipping-method-item</item>
            </item>
        </item>
    </item>
</item>

What would be the best approach to accomplish this task?


texts: I have a list of category names, and I was wondering if there a way in Magento to lookup the category id using the name? Please advise the easiest way to do this.


texts: Custom EAV Category Attribute is Returning a Different Value

texts:
I have a custom EAV attribute called thumbnail_link_text which is a category attribute. When I try to display it either on the frontend or backend using the default accessor like this,

echo $category->getThumbnailLinkText();

it is always returning a value of 1. I'm sure it is not a boolean because the data type of this attribute is text.

Also, in Magento 2's admin panel, I added a custom category field where you can enter an input value for this attribute.

I tried entering a new value on a certain category but it is also sets the value to 1 after saving.

I checked the database on the table catalog_category_entity_text, and the correct value is stored successfully. Meaning, the custom attribute is working when saving but not working when displaying. But, this is working before in production.

Another thing that's confusing is that the custom attribute is working perfectly in my development server but not in production server anymore. The dev server is a perfect clone of the production server. Only that the version of the dev is in 2.2.8 and the production is 2.2.5.

Am I missing something to check and test? Is it a directory or a file permission issue? A 3rd party or another custom module? Or an interceptor? If the category is being overridden somewhere, why is it that only this attribute is being affected?


texts:
Is there a way to hide cart if an item is empty and show it when there is product added to cart without reloading the page?

Thank you.


texts: Magento Newsletter Subscription Confirmation NOT sent

texts:
I've noticed that when entering an email in the newsletter subscription field on my website for newsletter confirmation, the customers do not receive subscription confirmation in their emails.

In the System  >  Configuration > Newsletter > Need to confirm **(YES)**

Even though it says YES, there are no  emails sent to customers that asks customers to re-confirm whether they actually want to sign up for newsletter. Its also called "Double-Confirmation"

Please help me out.

Many thanks!


texts: How to use getMethodLabelAfterHtml($_method)

texts:
I'm looking to programmatically add an extra label to my payment options and while studying methods.phtml I see the following code:

<?php echo $this->getMethodLabelAfterHtml($_method); ?>

Now it seems this is exactly what I need, but I have no idea how to use it. It sure looks very similar to:

<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
    <?php echo $html; ?>
</dd>

I know this calls the form.pthml corresponding to the currently parsed payment method. Does getMethodLabelAfterHtml($_method) also work with a .pthml file? And if yes, where do I put it and are there examples available?


texts: Get product collection filter by from and to date in magento2.

texts:
I want to get product collection filter by From date and to date. How can I get this?

I have used below code in my phtml file so I get all product collection.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');

$collection = $productCollection->create()
        ->addAttributeToSelect('*')
        ->load();

foreach ($collection as $product){
//echo 'Name  =  '.$product->getName().'<br>';
}

Right now I have used addAttributeToSelect('*') so I am getting all product collection but I want to filter these collection by from date and to date.

How can I get that?


texts: What causes the Object DOMDocument should be created error?

texts:
I'm currently modifying a converted Magento 1.9 module to be used for Magento-2 but i keep getting this error:

  Object DOMDocument should be created

It happens every time I try to access the login page.

I put the module in a GitHub project found here.

If anyone can tell me what normally causes this error that'd be great.

system.log stack:

[2016-11-10 12:01:21] main.CRITICAL: Class Inchoo\SocialConnect\Model\Google\Client does not exist [] []
[2016-11-10 12:01:21] main.CRITICAL: Invalid block type: Inchoo\SocialConnect\Block\Login [] []
[2016-11-10 12:01:21] main.CRITICAL: Class Inchoo\SocialConnect\Model\Google\Client does not exist [] []
[2016-11-10 12:01:21] main.CRITICAL: Invalid block type: Inchoo\SocialConnect\Block\Google\Button [] []
[2016-11-10 12:01:21] main.CRITICAL: Class Inchoo\SocialConnect\Model\Facebook\Client does not exist [] []
[2016-11-10 12:01:21] main.CRITICAL: Invalid block type: Inchoo\SocialConnect\Block\Facebook\Button [] []
[2016-11-10 12:01:21] main.CRITICAL: Class Inchoo\SocialConnect\Model\Twitter\Client does not exist [] []
[2016-11-10 12:01:21] main.CRITICAL: Invalid block type: Inchoo\SocialConnect\Block\Twitter\Button [] []
[2016-11-10 12:01:21] main.CRITICAL: Class Inchoo\SocialConnect\Model\Pixelpin\Client does not exist [] []
[2016-11-10 12:01:21] main.CRITICAL: Invalid block type: Inchoo\SocialConnect\Block\Pixelpin\Button [] []


texts: Magento 1.9.4.1 Text-area attribute not showing on product detail page

texts:
The following text-area attribute has been configured (see screenshots)

The attribute has been included in an attribute set, and on the respective product a custom text has been added.

On the product view template, I have added the following test-code:

<div class="test">
<?php
if ($_helper->productAttribute($_product, $_product->getSpecialShippingnInformation(), 'special_shipping_information')) {
    echo $_helper->productAttribute($_product, $_product->getSpecialShippingnInformation(), 'special_shipping_information');
}
?>
</div>

Unfortunately the text stored in the text-area attribute is not being shown. Is there anything else I should take into account/something I'm missing?

Thakns for your collaborations.


texts: Intermittent 'this site can't be reached' problem with saving admin settings panel

texts:
long post, but this is a strange problem.

I'm currently running Magento 2.1.9 community with the porto 2.6.2 theme.

Every time I try and save the 'Stores -> Configuration -> Porto Settings' Panel admin page it's a lottery as to whether the page will save or not. Half the time it's fine, the other half of the time I get 'this site cannot be reached' (with a changed key in browser) and have to go back and try again. Other admin pages are fine.

Some of the time, when it craps out it will also erase part of the information in an unrelated field in that admin page, eg will wipe out part of the 'Previous Link Text' field and save the changes. So it does at least appears to be doing something.

This admin page primarily contains custom css information. I have removed all of this into a custom CSS file to shorten the information on the admin page, but the problem still persists.

I have tried:

clearing cookies in browser
different browsers
different machines
clearing static files in magento
ticketing porto, but they say its probably server related

and yet problem persists. I have seen this on 2 different porto magento 2 installs, but not on other themes. The only way I've ever 'solved' this was when I started using a SSL certificate on one site and converted the admin/site to https and the problem magically disappeared.

Changing the other site to https without a certificate didn't solve the problem, and i don't see how this would be related in any case.

Has anyone else had a similar experience in Magento 2 admin?

Many thanks for reading.


texts: Source class (PATH) for (PATH) generation does not exist

texts:
1 exception(s):
Exception #0 (RuntimeException):

Source class "\Vendor\ModuleName\Model\ResourceModel\CapabilityInterface" for "Vendor\ModuleName\Model\ResourceModel\CapabilityRepository" generation does not exist.

where as in my di.xml I have mentioned

<preference for="Vendor\ModuleName\Api\CapabilityRepInterface"
            type="Vendor\ModuleName\Model\ResourceModel\CapabilityRepository" />

when I run

  php bin/magento setup:di:compile

It doesn't give any error but when i inject this interface in my controller the above error is shown.

use Magento\Backend\App\Action;
use Magento\Framework\App\ResponseInterface;
use Vendor\ModuleName\Api\CapabilityRepInterface;

class Temp extends Action
{
protected $capabiliyRepo;

public function __construct(
    Action\Context $context,
    CapabilityRepInterface $capabilityRep
)
{
    parent::__construct($context);
    $this->capabiliyRepo = $capabilityRep;
}

public function execute()
{
    $this->capabiliyRepo->checkAbility("my_project_create_project");
}
}


texts: Magento 2 - what event should I observe to change/intercept the calculation of subtotals on Cart

texts:
I am using Magento 2.

I made an observer that observes anytime a new item is added to the cart. The observer works properly, I also managed to create a single product discount with this observer, here is the events.xml file:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_cart_product_add_after">
    <observer name="PerfectStorm_Pricecalculations_Addtocart" instance="PerfectStorm\Pricecalculations\Observer\PricecalculationsAfterAddtoCart" />
</event>

The problem is, I want to do the same in order to change and intercept the calculation of the subtotals in the cart for each item. But I don't know what event should I observe.

Can you please advice?

Thanks


texts: After upgrade magento 2.1.11 => 2.2.3, I got below error how to fixed it

texts:
Notice: Undefined index: src in /vendor/magento/framework/View/Page/Config/Generator/Head.php on line 125

How to fix it. please reply.

Thanks


texts: Security Patch SUPEE-10266 - Possible issues?

texts:
A new security patch is out for Magento 1, addressing 13 APPSEC issues

https://magento.com/security/patches/supee-10266

What common issues do you have to watch out for when applying this patch?

  SUPEE-10266, Magento Commerce 1.14.3.6 and Open Source 1.9.3.6 contain multiple security enhancements that help close cross-site request forgery (CSRF), unauthorized data leak, and authenticated Admin user remote code execution vulnerabilities. These releases also include fixes for issues with image reloading and payments using one-step checkout.


texts: UI component - display the time to 'Y-m-d H:i:s' format(ISO time format)

texts:
I create some admin listing pages by UI component, the default time format in their time column all like below

The UI component codes like below

<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="filter" xsi:type="string">dateRange</item>
            <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
            <item name="dataType" xsi:type="string">date</item>
            <item name="label" xsi:type="string" translate="true">Created At</item>
        </item>
    </argument>
</column>

The time format in database is right(ISO time format), that is what I want to display.

So, how to display the time to "Y-m-d H:i:s" format(ISO time format) in UI component? Thanks for any advice :)


texts:
In magento1, We are using below code to get the total orders by a customer

$customer = Mage::getSingleton('customer/session')->getCustomer();
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addFieldToFilter('customer_id', $customer->getId());
echo $orders->getSize();

How to get same in magento2 ?. Any help would be appreciated.I want get this on order success page with using Object manager.


texts:
I have custom script located inside Magento root directory used for ajax call. I am wondering what would be the safest way to get proper root url, no matter which store is user currently at.

Will Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) always show root url without index.php or store code or anything else inside url?

I made some testing and it looked fine, but maybe I missed something that will show up on one of the 1000 different stores where this will be used. This is why I am asking this question.

Tnx!


texts:
I want to implement lazy loading on my homepage.
Does anyone have any example for how to implement lazy loading?


texts: Coupon code for whole cart not applied to multiple items

texts:
What it should do:
A coupon code which provides a discount of 5 € on the whole cart, if the subtotal equals or is greater than 40 €.

What it does:
It works fine with one article (even multiple units of that article), but when I put different articles in the cart, the discount is indetermined lower.

Actions:

Conditions:


texts:
Hello I've this custom module for Magento when loggin in to Magento Admin I am getting this error

Error Message I am getting

  1 exception(s): Exception #0 (LogicException): Could not create an acl
  object: Invalid XML in file
  /home/web/public_html/app/code/Pmage/Matrixprice/etc/acl.xml: Element
  'config', attribute
  '{http://www.w3.org/2001/XMLSchemainstance}noNamespaceSchemaLocation':
  The attribute
  '{http://www.w3.org/2001/XMLSchemainstance}noNamespaceSchemaLocation'
  is not allowed. Line: 2

  Exception #0 (LogicException): Could not create an acl object: Invalid
  XML in file
  /home/web/public_html/app/code/Pmage/Matrixprice/etc/acl.xml: Element
  'config', attribute
  '{http://www.w3.org/2001/XMLSchemainstance}noNamespaceSchemaLocation':
  The attribute
  '{http://www.w3.org/2001/XMLSchemainstance}noNamespaceSchemaLocation'
  is not allowed. Line: 2

The Code is as follows

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Adminhtml::admin">
               <!--AddMenuAcl-->
                   <resource id="Pmage_Unit::unit"  title="Pmage">
                        <resource id="Pmage_Matrixprice::manage_matrix" title="Manage Matrix" />
                    </resource>
            </resource>
        </resources>
    </acl>
</config>


texts: I want to add an image uploader same like already exist in catalog/category/index/ name homepage image in same page

texts:
I want to create a image uploader on catalog/category/index/ just like homepage image which is on catalog/category/index/ page

Now I am using this to create same above but not success
InstallData.php
eavSetupFactory = $eavSetupFactory;
    }

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

        $eavSetup->addAttribute(
            \Magento\Catalog\Model\Category::ENTITY,
            'category_child_image',
            [
                'type'         => 'varchar',
                'label'        => 'Category Child Image',
                'name'         => 'Category Child Image',
                'input'        => 'image',
                'backend'      => 'Magento\Catalog\Model\Category\Attribute\Backend\Image',
                'global'       => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
                'visible'      => true,
                'required'     => false,
                'user_defined' => true,
                'group' => 'General Information'
            ]
        );
    }
}

category_form.xml

                    false

                        false

Iversa_StaticCategoryImage/form/element/custom-button
                    category_child_image

                        category_child_image
                        file
                     -->
                <item name="sortOrder" xsi:type="number">333</item>
                <item name="dataType" xsi:type="string">string</item>
                <item name="formElement" xsi:type="string">image</item>
                <item name="label" translate="true" xsi:type="string">Category Child Image</item>
            </item>
        </argument>
    </field>
</fieldset>

custom-button.html

    Select from Gallery

and I got this

please help me


texts: How to add new column and custom attribute in order email template in Magento 1.9.3?

texts:
In this new order email.

I want to add a column in this table where i want to show a custom product attribute..

Please tell me how can i add column inside the new Order confirmation email template so it will show another column and attribute

already tried  editing

app/design/frontend/template/default/template/email/order/items/order/default.phtml
app/design/frontend/base/default/template/email/order/items/order/default.phtml

and template files in app/locale folder.

Thanks


texts: Add simple products to configurable product using soap api

texts: I wants to associate simple products to configurable product from while creating the configurable product using soap api in magento1.9


texts:
Magento 2.3.* files upgraded using composer. After that used to upgrade module setup using following commands but facing error.

bin/magento setup:upgrade

Error:

Cache cleared successfully
File system cleanup:
/generated/code/Composer
/generated/code/MSP
/generated/code/Magento
/generated/code/Symfony

The directory '/generated/metadata/' doesn't exist - skipping cleanup
Updating modules:
Schema creation/updates:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.temp' doesn't exist, query was: SHOW CREATE TABLE temp

Help is much appreciated..I have tried many times facing issues, is there any permission issue?
Thanks.


texts: how to disabled the core module completely (Frontend)

texts: I want to disabled the Mage_Checkout completely. but when i disabled the adavnced > modules it shows blank page not 404 page. when i disabled the from etc/modules it show errors of dependent module. any other solution


texts: Does the free shipping normally method remove all others?

texts:
If free shipping is available, all other methods disappear in my shop.

Is this standard functionality (otherwise I might have to search for a custom modification)?

If it is standard, where in the code does that happen? The goal is to have some shipping methods still appear, even if free shipping is available.


texts: OpenMage 20.01 - what version of Magento and Supee

texts:
Just updated to OpenMage LTS 20.0.1.  Having issues with PCI compliance - the scan is showing Magento version 1.9.4.4.
Is this a false positive?
If so is OpenMage LTS 20.0.1 based on 1.9.4.5 + Supee 11346


texts: Magento 2 get catalog rule product details in final_price.phtml

texts:
I will try keep simple and short.

e.g I have set a rule in catalogrule table  and I am interested in 2 fields value:

simple_action: by_percent
discount_amount: 40.0000

and in  catalogrule_product table there are 2 field that I am interested they are:

action_operator: by_percent
action_amount: 40.0000

How do one get action_operator and action_amount values in final_price.phtml ?


texts: How can i disable plugin image in wysiwyg only in my module?

texts:
Hi everyone,

I want to disable upload images in wysiwyg editor only in my module, how can i do that ?

I'm in magento 2.3.3

Button "Insert image.."

Plugin image in toolbar

Thankyou !


texts: Multiple For each loop value to Json string

texts:
$data= array();
 foreach($itfdatas as $key=>$itfdata){

$checkemps = explode(',',$itfdata['employee_id']);

  $data[] = array(
            'id'=>mysql_real_escape_string($itfdata['P_id']),
            'job_id'=>mysql_real_escape_string($itfdata['quote_id']),
            'job_title'=>mysql_real_escape_string($itfdata['job_title']));

foreach ($checkemps as $checkempss){
  $empusers =  $users->ShowAllEmployeeByJobId($checkempss['profile_id']);

      $data[] =array(
            'helper_id'=>mysql_real_escape_string($empusers['profile_id']),
            'helper_name'=>mysql_real_escape_string($empusers['name']));

   }

$msg=array('status'=>'success','emp_job_list'=>$data);
$itfresinfo=json_encode($msg);

     }

    echo $itfresinfo;

The above code gives the below output

          {
          "status": "success",
        "emp_job_list": [
        {
        "id": "1",
        "job_id": "MM\/IR1",
        "job_title": "2 Men with 4.5 Tonne Truck"
        },
        {
        "helper_id": "1",
        "helper_name": "Vivek"
        },
        {
        "helper_id": "3",
        "helper_name": "Akhilesh"
        },
        {
        "id": "2",
        "job_id": "MM\/IR2",
        "job_title": "This is the test asasascvcvcv"
        },
        {
        "helper_id": "1",
        "helper_name": "Vivek"
        },
        {
        "helper_id": "3",
        "helper_name": "Akhilesh"
        }
        ]
        }

But I want the below output

                         {
            "status": "success",
            "emp_job_list": [
            {
            "id": "1",
            "job_id": "MM\/IR1",
            "job_title": "2 Men with 4.5 Tonne Truck",
            "helper_detail":[
            {
            "helper_id": "1",
            "helper_name": "Vivek"
            }
            ]

            },
            {
            "id": "1",
            "job_id": "MM\/IR1",
            "job_title": "2 Men with 4.5 Tonne Truck",
            "helper_detail":[
            {
            "helper_id": "1",
            "helper_name": "Vivek"
            }
            ]

            }
            ]
            }


texts: Is it possible to change output function call parameters using a plugin

texts:
Like I have this function

public function letsTry(){
 $this->callFuncion($name1, $name2, true);
}

private function callFunction($arg1, $arg2, $arg3 = false){
  // do stuff
}

How i can change the 3rd parameter true to false using plugin or remove it. Or i need to use preference for this?


texts: How to retrieve Maximum Qty Allowed in Shopping Cart in code

texts:
In the magento API how can I retrieve the "Maximum Qty Allowed in Shopping Cart" for a specific product?

I know for the min qty allowed its $_product->getStockItem()->getMinSaleQty();   I tried getMaxSaleQty but that doesn't appear to be it.


texts: Trouble applying PHP 5.4 patch on Magento 1.7.0.2 Community

texts:
When trying to apply the patch for PHP 5.4 compatibility of Magento 1.7.0.2, I get the following shell output:

user@server [~/public_html]# sh magento-php54-patch.sh
: command not found.sh: line 7:
'agento-php54-patch.sh: line 9: syntax error near unexpected token `{
'agento-php54-patch.sh: line 9: `_check_installed_tools() {

I obtained the patch file by copy/pasting into my Windows text editor, then uploading to my CentOS web server. OS-specific text file formatting issues, perhaps?

As requested, first part of script:

#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.

# 1. Check required system tools
_check_installed_tools() {
    local missed=""

    until [ -z "$1" ]; do
        type -t $1 >/dev/null 2>/dev/null
        if (( $? != 0 )); then
            missed="$missed $1"
        fi
        shift
    done

    echo $missed
}


texts: Migration from live or cloned Database & Delta Migration Question

texts:
From what I have read online, it's best to migration from the "cloned" database, instead of "live" database.

Since the migration step will create logs in Magento 1 database for the next delta step. My question is that if i use the cloned database, how do I handle the changes between the first migration and before goes live?


texts: How to add more sliders than 1 slider to home page?

texts:
We currently have 1 slider on our home page. We want to add another in a new area. Is there a plugin/app that will allow us ? or is just just a case of copying the HTML code ?

This is  a big topic for us as we have having difficulty with it.

Any feedback and help would be great thank you.


texts: Is there still a use case for database table prefix in Magento?

texts:
I remember the Prefix once was incented, because a lot of hosters only supported one Database per users, so many applications needed to share one database and it could come to conflicts. Also the prefix enabled you to install more then one magento into the same Database.

But, is there still a reason for them today I do not see?
Even on a free hoster you get by far enough databases what I know.


texts:
I'm extending the \Magento\Catalog\Block\Product\View file in AddToCart.php.

In my AddTocart, I've added this line :

$stock = $this->isInStockCustom($sku);

Now, I'm adding options to my products. It was working find until now.

But if I add an option to this product, in my log, I have this

  Invalid method
  Magento\Catalog\Block\Product\View\Interceptor::isInStockCustom [] []

But if I remove the options, I don't have this error anymore.

Any help would be very appreciated.


texts: Products can not be added to cart by click "Add to cart" for second time

texts:
I have Related products block in my product description page. I have configured a particular product's Minimum Qty = 5. So users can only buy products in multiples of 5.

Below is the screenshot of adding the simple product of MinQty(5) to cart from the related products block. The product is added successfully by Ajax and the minicart is updated and Network tab shows response 200.

Succesful addition of product to cart (ss1):

But the issue is, When i click "Add to cart" for the second time the product with MinQty(5) is not getting added to cart. Even though the network tab show 200 response for the request. Below is the screenshot of not able to add products second time.

I found this issue in Magento 2.1.9 version.
I am using Amasty_Cart for Ajax Add to cart.

Please help me, what's wrong in second time ?


texts: How to move attribute values from int to varchar table?

texts:
I had to switch a dropdown field to a multiselect field. Previously the values were stored as integers (in catalog_product_entity_int) but now with multiselect I have to use varchar (catalog_product_entity_varchar).

I'm not sure how to move the data from one table to another with a data script so I would be glad if someone can provide me a possible solution or any thoughts on how to do it.

I googled already a bit but I guess I use the wrong search words..

Thanks in advance


texts: Magento2: How to change store view during mass edit products

texts:
I have try bulk translate description products.

1) When I open single product "edit" then I can switch store view and add separate language to each store view:

But when I try to select and translate  bulk products from "Catalogue":

Impossible select from here store view. When I translate from here description product from English to Polish then translate as default (for every store view).

Any slotuion ?


texts:
I have a magento website , this website has two different themes. All db and products are the same but my new theme seems much slower to load the product details page. My new theme takes twice the time as compared to the old one.

How can I fix this issue I want to analyse which part takes more time is there a way to analyse using break points like which part(s) are more complex and consumes more time?

Please guide me how to do it

1: As theme is just different, all other factors are the same
2: I want to know which part takes time, I tried commenting out whole view.phtml but still there was a load issue there, how can I break and debug it to find out the exact issue?


texts: Override HTML Template from custom module not working

texts:
I am trying to override HTML template in my custom module. I am working on Magento ver 2.2.2

  Vendor/Moule/view/frontend, I have created a requirejs-config.js file:

    var config = {
    map: {
        '*': {
            'Magento_Checkout/template/minicart/content.html': 'Vendor_Module/template/minicart/content.html',
            'Magento_Checkout/template/minicart/item/default.html': 'Vendor_Module/template/minicart/item/default.html'
        }
    }
};

Copied custom file minicart\content.html to

  Vendor\Module\view\frontend\web\template\minicart\content.html and

copied minicart/item/default.html to

  Vendor\Module\view\frontend\web\template\minicart\item\default.html

Run below commands:

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

After doing this, my default files disappear and my files are not showing, please let me know if I am doing something wrong.Thanks in advance :)


texts: Add New inbox tab in customer my dashboard in magento 2

texts: I need to create a new tab in customer my dashboard using magento 2 called mymail(inbox). Any email, admin send to customer id then store also in this tab based on Gmail Inbox. Anyone know how to do this?


texts: Catalog price rules - cant add more than "category" or "attributeset"

texts:
i finally was about to add some catalog price rules.
I´ve googled many times and cant explain it to myself so far.
Why I just can choose between two options: category and attributeset?

I´ve seen many screenshots where they can choose from many more options. I cant realize the requirements of the shopowner this way and still beeing speechless.

I have to add discounts per manufacturer - manufacturer are given within the attributesets.

Did I do something wrong or forget something?


texts: Magento 2 - Products not appearing in categories on frontend

texts:
I am running Magento ver. 2.1.11 with over 36000 products in total, Max 2000 products per category. Caching enabled and using Varnish. Randomly and inconsistently I find that products completely disappear from categories. It could be any category at any time. This is my setup:

Use Flat Catalog Category = No
Use Flat Catalog Product = No
All indexers set to "Update on save"
I have noticed a custom extension that integrates products from external source and also reindexes the site every 5 mins.

Running php bin/magento indexer:reindex -vvv sometimes results in:

main.CRITICAL: PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded

I've investigated the logs and there are some errors have occur regularly that could be indirectly related:

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

and on product save (could be via admin or programmatically, not sure which):

main.CRITICAL: Exception: Asymmetric transaction rollback

I saw this issue which I thought could be the cause: https://github.com/magento/magento2/issues/8681 - where:

  There is a constant variable called RANGE_CATEGORY_STEP, and it is set to 500. This variable is used when the function isRangingNeeded() returns true for an index (which is the default unless overridden). This effectively limits what gets put in the product category index table which in turn shows a limited result set of products on category pages.

I implemented this fix, but the problem still persists.

Regarding this custom extension, I have looked through the code, here is a snippet where products are being programmatically assigned to categories:

/**
     * Associates a product to a category, and/or update's the product's
     * position within the category.
     *
     * @param int $productId
     * @param int $categoryId
     * @param int $position
     * @return Api
     */
    public function associateToCategory($productId, $categoryId, $position = null)
    {
        $conn = $this->connection;
        $table = $this->getTableName('catalog_category_product');
        $sql = $conn->select()
            ->from($table)
            ->where('category_id = ?', $categoryId)
            ->where('product_id = ?', $productId)
        ;
        $row = $conn->fetchRow($sql);
        if (false === $row) {
            $bind = [
                'category_id' => $categoryId,
                'product_id' => $productId
            ];
            if (\is_numeric($position)) {
                $bind['position'] = $position;
            }
            $conn->insert($table, $bind);
        } elseif (   \is_numeric($position)
                  && \is_array($row)
                  && $row['position'] != $position
        ) {
            $conn->update(
                $table,
                ['position' => $position],
                $conn->quoteInto('entity_id = ?', $row['entity_id'])
            );
        }
        return $this;
    }

It looks like it directly manipulates the db, perhaps this could cause some issues?

The workaround

So far is to clear the cache after the products are discovered to be missing.


texts: How to change number of items in a row Magento 2

texts:
I've been through topics like this:
Magento 2 change number of items per row

All of them claims, that if I wanna change my items row to display 4 instead of 5, then I would have to change in a file called _listings.less

Seems simple enough, but my issue appeared, when I discovered, that I am missing this file.

Actually my folder structure looks way different. I did a search all over my FTP to find the file, but it didn't find it.

I am missing the web-folder in /public_html/app/design/frontend/Outline/outline6/Magento_Catalog

I've been looking around, but it seems that I need to find this file to do it officially, and not in an unrecommended way.

How can I move on from here?

I appreciate your time.


texts: cannot read property 'section loadurl' and '*' of undefined in magneto2.1

texts:
I'm getting this error in homepage.

Any help!


texts: How to delete empty select option value in magento

texts:
In the checkout process of magento, customers are allowed to select countries. In administration in magento administrator is allowed to restricted shipping only to selected or one country, in my case one country which is Bosnia and Herzegovina. Even I have restricted doing business only in my country, i would like to be able to not allowed to  customer to change the country to empty field, which is still present.

Bellow is the code:

<select title="Country" class="validate-select" id="billing:country_id" name="billing[country_id]">
<option value=""> </option>
<option selected="selected" value="BA">Bosna i Hercegovina</option>
</select>

I would like to delete, somehow, unnecessary empty option, and that would be the following code:

<option value=""> </option>

Thanks :)


texts:
i have placed the following code in my template files, in order to resize some custom category images

$image = new Varien_Image($imagePath);
$image->constrainOnly (true);
$image->keepAspectRatio (false);
$image->keepFrame (false);
$image->quality (90);
$image->resize($width, null);
$image->save($rszImagePath);

The code works fine and images are resized properly. But as soon as I set keepAspectRatio to true, no resizing is being applied to images.

Why is this happening and what can I do to fix it?


texts: Filtering product collection producing incorrect behaviour with flat catalog enabled in admin

texts:
I am using the below code for get most-viewed product in my store front:

$storeId = Mage::app()->getStore()->getId();
$products = Mage::getResourceModel('reports/product_collection')
    ->addOrderedQty()
    ->addAttributeToSelect('*')
    ->addAttributeToSelect(['name', 'price', 'small_image'])
    ->setStoreId($storeId)
    ->addStoreFilter($storeId)
    ->addViewsCount();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

$products->setPageSize(5)->setCurPage(1);
$this->setProductCollection($products);

It's working fine when "Use Flat Catalog Product" is set to no.
But when I set "Use Flat Catalog Product" to yes, product name, price and small_image attribute not get in collection.

Please help


texts:
I created a new product attribute and I want to display it in order email. How can I do that?
I found the code in here:

app/design/frontend/base/template/email/order/items/order/default.phtml

I try to add this line but it didn't work

<?php echo $this->__('my_attribute_code') ?>

Thank you so much!


texts:
Do I need to develop a custom-module to make changes to the way Magento2 cart shows whats in it?

Do I need to make changes into this file:

  vendor\magento\module-checkout\view\frontend\templates\cart\item\configure\updatecart.phtml

Is it possible to do this with a template or do I need to develop a module?


texts: How to parse XML - simplexml_load_string returns error "parser error : StartTag: invalid element name"

texts:
I am trying to parse XML to array in my custom module in Magento 2.2.7. Community version (free)

I am loading Helper\Data through Block element and this is "working".

This is my Helper\Data.php

<?php

namespace Vendor\Categories\Helper;
use Magento\Framework\Serialize\SerializerInterface;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{

   private $xml2;
   private $xml;

  public function __construct(SerializerInterface $serializer) {
    $this->serializer = $serializer;
    $this->xml2 = dirname(file_get_contents('import/kategorije-za-import.xml'));
    $this->xml = $this->serializer->unserialize($this->serializer->serialize(simplexml_load_string($this->xml2)));

  } // end of construct

  public function testing(){
    var_dump($this->xml);
  }

This outputs error in

[2019-02-16 10:27:51] main.CRITICAL: Warning: simplexml_load_string(): Entity: line 1414: parser error : StartTag: invalid element name in /home/user/public_html/app/code/Vendor/Categories/Helper/Data.php on line 19 [] []

XML file location is:
\home\user\public_html\import\kategorije-za-import.xml

My xml file is:

<?xml version='1.0' encoding='UTF-8'?>
<NewDataSet>

    <CategoryID>1</CategoryID>
    <CategoryName>Hardware</CategoryName>
    <ParentCategoryID>0</ParentCategoryID>

    <CategoryID>2</CategoryID>
    <CategoryName>Paketi i bundle</CategoryName>
    <ParentCategoryID>1</ParentCategoryID>

    <CategoryID>3</CategoryID>
    <CategoryName>Matične ploče</CategoryName>
    <ParentCategoryID>1</ParentCategoryID>

    <CategoryID>4</CategoryID>
    <CategoryName>Intel</CategoryName>
    <ParentCategoryID>3</ParentCategoryID>

</NewDataSet>

I have tested this as a script outside Magento and XML file loads and parses as array.

What to do? :)


texts: Magento 2: Regenerate categories URL rewrites

texts:
Can somebody tell me how can i regenerate category URLS in magento 2?
I did not found any solution or module, that can help me.
Here i found module, that regenerate URLs for products and it's work fine, but i need to regenerate category urls.
So, can somebody help me?
Thanks!


texts: Need help with url redirecting to indegogo

texts:
We have just installed our magento site however we are getting ready to start an indegogo campaign to start gain funding. What we would like to do is allow someone to click on a link (eg. Add to cart) and have it send them to our indegogo campaign for the time being.

We are fairly new to Magento CE and using 1.9 currently. So any help would be appreciated.


texts: Adding the Custom links under dropdown toggle my account dashboard section in magento2

texts:
Can anyone help me how to add customly added myaccount dashboard links in a Toggle section in magento2

Please find the screenshot.

Thanks


texts: catalog price rule disappear after mid night

texts:
have a problem with catalog price rules in 1.9.0

we uploaded about 1000 products in a site.

we applied catalog price rules to give discount for 500 products.

i did't gave any date limit for catalog price rules

those special prices are displaying only until mid night.

next day, after mid- night special prices are not displaying in site.

here i posted catalog price rule table : catalogrule_product_price image

seems primary key not reached to max limit, please give some guidance about this image.


texts: Adding code to the head section of homepage only

texts:
How do I add code to the head of my homepage only? I did some research and I think it needs to go into layout.xml under  but it doesn't seem to be showing. My code with this added is below:

<cms_index_index>
        <update handle="MAP_popup"/>
        <reference name="head">
<link rel="alternate" href="https://www.MYURL.com/" hreflang="en" />
<link rel="alternate" href="https://www.MYURL.com/spanish_store/" hreflang="es" />
<link rel="alternate" href="https://www.MYURL.com/portuguese_store/" hreflang="pt-br" />
            <action method="addJs" ifconfig="mango_settings/newsletter_popup/enabled"><script>smartwave/jquery/jquery.cookie.js</script></action>
        </reference>
        <reference name="before_body_end">
            <block type="newsletter/subscribe" name="newsletter_popup">
                <action method="setTemplate" ifconfig="mango_settings/newsletter_popup/enabled"><template>newsletter/popup.phtml</template></action>
            </block>
        </reference>
    </cms_index_index>

The section I added (and need to add) is:

<link rel="alternate" href="https://www.MYURL.com/" hreflang="en" />
<link rel="alternate" href="https://www.MYURL.com/spanish_store/" hreflang="es" />
<link rel="alternate" href="https://www.MYURL.com/portuguese_store/" hreflang="pt-br" />

Thanks in advance.


texts: How to remove a search filter after an error is generated?

texts:
I have a bit of an annoying problem.  I setup a search filter in the Product Catalog window filtering for a specific website.

Later in the day, after some testing, I deleted that website/store/storeview.

Now, when I go back to the Product Catalog table, it generates a "Something went wrong" error, which then prevents me from ever clearing the problematic filter.

Does anybody know of a way to remove a filter after an error has been generated?


texts: How to programatically disable shipping method in magento

texts:
I am using two shipping method Free shipping and flat rate shipping .
Here is two condition when a user try to buy "apple" from state "abc" then flat rate shipping available for this user.and another user try to buy same product "apple" from state "xyz" then free shipping is available for this user.
I know it can be done by using observer but unable to find any exact solution please help me thanks.


texts: Magento 2 - Custom Homepage block not showing

texts:
I have developed a custom homepage layout and applied to the homepage. I've tried to add a created block in Magento_theme/templates/html/homepage.html but it is not displaying. Can anyone check problem in my code?

   <body>
    <update handle="empty"/>
    <referenceContainer name="page.wrapper">
        <container name="header.container" as="header_container" label="Page Header Container"  htmlTag="header" htmlClass="page-header" before="main.content"/>
        <container name="page.top" as="page_top" label="After Page Header" after="header.container"/>
        <container name="footer-container" as="footer" before="before.body.end" label="Page Footer Container" htmlTag="footer" htmlClass="page-footer" />
    </referenceContainer>

      <referenceContainer name="main.content">
          <block class="Magento\Framework\View\Element\Template" name="burgHomepage" template="Magento_Theme::html/homepage.phtml" />
      </referenceContainer>
    </body>


texts: Magento2 : Layer Navigation Product Collection Returns Inconsistent Results

texts:
I'm running code on my Product List page. First time on page get 4 items. if I refresh page, I'll get 6, then 4, then 5 etc. I can't see any reason for this. I checked my query and it's always same. If someone could point me in the right direction, that would be helpful.

$products = $layer->getProductCollection()
                    ->addAttributeToFilter('part_number',array('in'=>$numbers))
                    ->setVisibility($this->productVisibility->getVisibleInSiteIds());


texts: Magento 2 - How to get product in a block

texts:
I'm trying to insert a block in default.xml layout so I created my app/code/Mainf/Stickers/view/frontend/layout/default.xml file:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Mainf_Stickers::css/mainf-stickers.css"/>
    </head>
    <body>
        <referenceContainer name="content">
            <block name="category.discount.sticker" class="Mainf\Stickers\Block\Discount" template="Mainf_Stickers::discount.phtml" cacheable="false" after="-" />
        </referenceContainer>
    </body>
</page>

and my block file (app/code/Mainf/Stickers/Block/Discount.php):

<?php

namespace Mainf\Stickers\Block;

class Discount extends \Magento\Framework\View\Element\Template
{
    protected $_product = null;

    protected $_coreRegistry = null;
    protected $_productFactory;

    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Framework\Registry $registry
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Model\ProductFactory $productFactory,
        \Magento\Framework\Registry $registry,
        array $data = []
    ) {
        $this->_productFactory = $productFactory;
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);
    }

    /**
     * @return Product
     */
    protected function _getProduct()
    {
        if (!$this->_product) {
            $this->_product = $this->_coreRegistry->registry('product');
        }

        return $this->_product;
    }

    public function isDiscounted()
    {
        $idProd = $this->_getProduct()->getData('entity_id');

        return true;
    }
}

When I call a category page, $this->_coreRegistry->registry('product') is empty, different from I call a product page.

How could I get "current product" when it loading a category page?

Is there any alternate method to get product apart from registry?


texts: Installed magento 2.1 on windows but it is is giving many require js errors

texts:
I have installed Magento 2.1 from web wizard installation but after installation It is giving require js errors and admin page is showing blank screen.

I tried deleting pub/static and var and then deployed but same problem again. Please help to resolve this issue.

ERROR:

ReferenceError: require is not defined

http://localhost/exassignment/pub/static/version1543493627/_requirejs/frontend/Magento/luma/en_US/requirejs-config.js:626:1


texts: How do I set enable qty increments and set the qty increment in php

texts:
I have a large list of products that for each I have to enable qty_increments and set the qty_ increment to a specific value for that product.

I am not sure how to do that in php.

I know how to get and save the product just not how do enable and set the increments

my input is:

sku qty_increment
sku qty_increment ....

Thanks


texts: Test Environment and back to Production via SSH

texts:
I'm trying to understand how to put online my Test Finished Magento and to have a Test folder where to continue to make customization to put on the store.

I don't find a guide that explain me, initially if I need to stop some counter or something similar. The point is, I put my store online, orders arrives, customers growns, and I'm steel modifying my site in the test environment. When It's ready, I want to update the live site. How can i do that without loosing customers and orders? Can you link me a guide or can you give me a procedure to follow. Best if it is in SSH. I think may be more fast to repeat in the future.

I think the same procedure I can repeat if some upgrades are released so if I update my test environment than I can copy with the same procedure, the new updated magento on the old live site, right?

Looking for guidance.Thank you!


texts: New orders are not showing in the orders grid but payement received?

texts:
I upgraded from Magento 2.2.5 to 2.3.1
I am using only PayPal as a payment method.
new orders are not showing in the orders grid in Admin > Sales > Orders and emails are not sent !!
when I check PayPal summary I can find the invoice number so it is created in Magento but not showing in the grid
I already tried to change

Store > Configuration > Advance > Developer > Grid Settings

Enable / Disable, flush cache, reindex, but not working
When I check sales_invoice and sales_order tables there is no recent invoice !!but in PayPal summary I have the invoice number and items !!
Any fix please.


texts: Where should I customize the "Sorry, no quotes are available..." message?

texts:
The full message is "Sorry, no quotes are available for this order at this time." but I see it in eleven locations in the source code!   Where do I change it for my own custom message, I hope not in all the locations.

Although I'm not trying to change the language, I wonder if this is related to localization, and maybe there is only one place I need to make the change?


texts: I want to hide shipping method step no 3 in checkout if free shipping available

texts:
I want to hide shipping method step only if there is free shipping.

we are giving free shipping only if cart value is less than 10000

I am new in Magento so tell me all step to customise this page.


texts: How to create system configuration for fileds of the custom table which is imports that fields using csv via import in admin configuration? Magento2.3

texts:
I have created the module to import CSV to a custom table. the columns of table should dynamically be added to the import.xml and not by code to import the CSV and not by code.in Magento 2
for example, I am using sales order table columns in

  customImport.php

const state = 'state';
    const status = 'status';
    const coupon_code = 'coupon_code';
    const protect_code = 'protect_code';
    const shipping_description = 'shipping_description';
    const is_virtual = 'is_virtual';
    const store_id = 'store_id';
    const customer_id = 'customer_id';
    const base_discount_amount = 'base_discount_amount';
    const base_discount_canceled = 'base_discount_canceled';
    const base_discount_invoiced = 'base_discount_invoiced';

and more..
these fields i have to add in system configuration to import in copy of legacy_order table


texts: How can i display admin users as product's attribute options in magento 2

texts:
I need to add a select type product attribute  (same as size/color) Magento 2. but options of this attribute should came from custom table (like admin user).

Thanks


texts: Magento 2: Admin Listing Submit Form with Values

texts:
I have below code.

magento\app\code\Custom\Module\Block\Adminhtml\Index.php

protected function _construct() {
    $this->addButton('select', array(
        'before_html' => '<form name="frm" id="frm" method="post" action=""><input name="form_key" type="hidden" value="' . $this->getFormKey() . '"/>',
        'label' => __('Select'),
        'type' => 'submit',
        'name' => 'select',
        'id' => 'select',
        'value' => 1,
        'after_html' => '</form>',
    ));
}

magento\app\code\Custom\Module\Block\Adminhtml\Module\Grid.php

 protected function _prepareColumns() {

    $this->addColumn(
                    'id', [
                'header_css_class' => 'a-center',
                'type' => 'checkbox',
                'name' => 'id',
                'align' => 'center',
                'index' => 'id',
                'values' => array(3,4),
                    ]
            );

    $this->addColumn(
                    'qty_succeed[]', [
                'header' => __('Qty'),
                'type' => 'input', // Change to Input
                'index' => 'qty_succeed',
                'editor' => 'text',
                    ]
            );
 }

I'm not using _prepareMassaction function as I'm not able to achieve needed functionality.

When clicked on "Select" button it should pass all values in Array so I can validate in Controller.

Question 1 How to add form on listing portion only? Because _prepareMassaction is not taking textbox values. It only takes checkbox values

Question 2 How to select main checkbox as well from Listing?


texts: Magento2 - Updating a list of stock items using REST (batch update)

texts:
I have built a custom module that will save a single stock item via REST API (similar to what is already available) - however, how would this be done with multiple stock items within the same request (like a batch update).  I've tried to make the @param an /../../inventoryItem[] in my method definition in the module/api folder, but it doesn't seem to work.

I see we can't simply send an array as we could in Magento 1.

the structure would be something like

{"inventory":[{"sku"=>"some_sku", "qty"=>10}, {"sku"=>"some_sku2", "qty"=>12}]}.

If someone could lead me over this architecturally - especially with the interfaces/classes required, then that would be helpful.

I assume I'd need such classes (as below) - one for the inventory object, another for the array - but I haven't worked extensively with interfaces and having trouble defining things in a Magento way.

<?php

class InventoryObject {

    private $sku;
    private $qty;

    public function __construct($sku, $qty) {
        $this->qty = $qty;
        $this->sku = $sku;
    }

    public function getQty(){
        return $this->qty;
    }

    public function setQty($qty){
        $this->qty = $qty;
    }

    public function getSku(){
        return $this->sku;
    }

    public function setSku($sku){
        $this->sku = $sku;
    }

}

class InventoryObjectArray {

    private $inventoryObject = array();

    public function __construct(InventoryObject $io) {
        $this->inventoryObject[] = $io;
    }

    public function setInventoryObject(InventoryObject $io) {
        $this->inventoryObject[] = $io;
    }

    public function getInventoryObject() {

        return $this->inventoryObject;
    }

}

then after this, I can loop through and save stock items one by one.  Do I need to define this?
Or just use the standard stockitem object and pass into an array?
In any case, bit confused and need assistance structuring things properly.


texts: How to check if an order is shipped by API?

texts:
I'm working on a task that need to check if an order is shipped by magento backend or by API. My question is how I can know that an order is shipped by API

Because I noticed that when shipped by API the bundle product, somehow the qty is wrong

File app\code\core\Mage\Sales\Model\Service\Order.php

public function prepareShipment($qtys = array())
    {
        $this->updateLocaleNumbers($qtys);
        $totalQty = 0;
        $shipment = $this->_convertor->toShipment($this->_order);
        foreach ($this->_order->getAllItems() as $orderItem) {
            if (!$this->_canShipItem($orderItem, $qtys)) {
                continue;
            }

            $item = $this->_convertor->itemToShipmentItem($orderItem);

            if ($orderItem->isDummy(true)) {
                $qty = 0;
                if (isset($qtys[$orderItem->getParentItemId()])) {
                    $productOptions = $orderItem->getProductOptions();
                    if (isset($productOptions['bundle_selection_attributes'])) {
                        $bundleSelectionAttributes = unserialize($productOptions['bundle_selection_attributes']);

                        if ($bundleSelectionAttributes) {
                            $qty = $bundleSelectionAttributes['qty'] * $qtys[$orderItem->getParentItemId()];
                            $qty = min($qty, $orderItem->getSimpleQtyToShip());

                            $item->setQty($qty);
                            $shipment->addItem($item);
                            continue;
                        } else {
                            $qty = 1;
                        }
                    }
                } else {
                    $qty = 1;
                }
            } else {
                if (isset($qtys[$orderItem->getId()])) {
                    $qty = min($qtys[$orderItem->getId()], $orderItem->getQtyToShip());
                } elseif (!count($qtys)) {
                    $qty = $orderItem->getQtyToShip();
                } else {
                    continue;
                }
            }
            $totalQty += $qty;
            $item->setQty($qty);
            $shipment->addItem($item);
        }

        $shipment->setTotalQty($totalQty);
        return $shipment;
    }

File app\code\core\Mage\Sales\Model\Order\Shipment\Api\V2.php

public function create($orderIncrementId, $itemsQty = array(), $comment = null, $email = false,
        $includeComment = false
    ) {
        $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
        $itemsQty = $this->_prepareItemQtyData($itemsQty);
        /**
          * Check order existing
          */
        if (!$order->getId()) {
             $this->_fault('order_not_exists');
        }

        /**
         * Check shipment create availability
         */
        if (!$order->canShip()) {
             $this->_fault('data_invalid', Mage::helper('sales')->__('Cannot do shipment for order.'));
        }

         /* @var $shipment Mage_Sales_Model_Order_Shipment */
        $shipment = $order->prepareShipment($itemsQty);
        if ($shipment) {
            $shipment->register();
            $shipment->addComment($comment, $email && $includeComment);
            if ($email) {
                $shipment->setEmailSent(true);
            }
            $shipment->getOrder()->setIsInProcess(true);
            try {
                $transactionSave = Mage::getModel('core/resource_transaction')
                    ->addObject($shipment)
                    ->addObject($shipment->getOrder())
                    ->save();
                $shipment->sendEmail($email, ($includeComment ? $comment : ''));
            } catch (Mage_Core_Exception $e) {
                $this->_fault('data_invalid', $e->getMessage());
            }
            return $shipment->getIncrementId();
        }
        return null;
    }


texts: Problem compiling!!! setup-di-compile yields segmentation error Magento 2.1.3

texts:
php bin/magento setup:di:compile
Compilation was started.
Proxies code generation... 0/7 [>---------------------------]   0% 1 sec 18.0 MiProxies code generation... 1/7 [====>-----------------------]  14% 1 sec 22.0 MiRepositories code generation... 1/7 [====>-----------------------]  14% 1 sec 22.0 MiB
Fatal error: Class 'Magento\Eav\Model\Entity\Attribute\Source\Boolean' not found in /home/oneupkey/public_html/vendor/magento/module-catalog/Model/Product/Attribute/Source/Boolean.php on line 14
Segmentation fault

Look at this...

I'm hosting with siteground. They said I need to post here or talk to devs.  AFAIK this is a default base install...


texts: Order history comment data is not post after adding tiny MCE

texts:
I am using Magento Latest version 1.9.3.

I have added tiny MCE editor on order history comment like below

While i have submit comment. history comment data is not post in addComment function.

for display editor i have use below code

tinyMCE.init({
    mode : "exact",
    elements: "history_comment",
    theme : "advanced",
    plugins : "inlinepopups,style,spellchecker,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect, | ,forecolor,backcolor,spellchecker",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
    theme_advanced_resize_horizontal : 'true',
    theme_advanced_resizing : 'true',
    apply_source_formatting : 'true',
    convert_urls : 'false',
    force_br_newlines : 'true',
    setup : function(ed) {
      ed.onInit.add(function(ed, evt) {
          //ed.getBody().setAttribute('spellcheck', true);
           setTimeout(function () {
              tinyMCE.activeEditor.controlManager.setActive('spellchecker', true);  tinymce.execCommand('mceSpellCheck', true);
             }, 1);
       });
     },
     //tinyMCE.activeEditor.controlManager.setActive.setAttribute('spellchecker', true),
     //tinyMCE.execCommand('mceSpellCheck', true),
    doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'

  });
};

Please let me know if any one have idea about this.


texts: How to call for an custom attribute in magento backend order page?

texts:
I have magento 1.9 and at the order page ( /app/design/adminhtml/default/default/template/sales/items/column/name.phtml ) I need to add a custom attribute called "location"

<?php if ($_item = $this->getItem()): ?>

<span id="order_item_<?php echo $_item->getId() ?>_title"><?php echo $this->escapeHtml($_item->getName()) ?>

<?php echo $this->helper('sales')->__('SKU') ?>: <?php echo implode('
', Mage::helper('catalog')->splitSku($this->escapeHtml($this->getSku()))); ?>

Locatie: <?php echo implode('
', Mage::helper('catalog')->splitSku($this->escapeHtml($this->getLocation()))); ?>

I'm not so good with magentoI have tried to mix codes I've found from blogs but still won't be able to get the value of "location".


texts:
I am making an ajax request in my module to grab some custom CRUD data to populate a select box on the fly.

I have a working ajax request and controller

Javascript

define(["jquery"], function($){
   return function(config, element) {

    $.ajax({
        url: 'leadmodel/ajax/index',
        type: 'POST',
        dataType: 'json',
        data: {},
        complete: function(response) {
            console.log(response.responseJSON);
        },
        error: function (xhr, status, errorThrown) {
            console.log(xhr);
            console.log(status);
            console.log(errorThrown);
        }
      }); // ajax function end here

}

})

Vendor/Module/Controller/Ajax/Index.php

<?php

namespace Vendorname\Modelname\Controller\Ajax;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;

class Index extends Action {

    protected $request;

    public function __construct(
        Context $context,
        array $data = []
    ){
        parent::__construct($context, $data);
    }

    public function execute() {

        $data = ['joe', 'bloggs'];

        $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
        $resultJson->setData($data);
        return $resultJson;
    }
}

Which works fine, it console log's the array and everything is great. But as soon as I pass a factory into the controller to build an array with custom CRUD model data, it breaks the controller and I just get a 500 error.

<?php

namespace Vendorname\Modelname\Controller\Ajax;

use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Vendorname\Modelname\Api\Data\LeadModelInterface;

class Index extends Action {

    protected $request;
    protected $_leadmodelCollectionFactory;

    public function __construct(
        Context $context,
        \Vendorname\Modelname\Model\ResourceModel\LeadModel\CollectionFactory $leadmodelCollectionFactory,
        array $data = []
    ){
        $this->_leadmodelCollectionFactory = $leadmodelCollectionFactory;
        parent::__construct($context, $data);
    }

    public function execute() {

        //Get the lead models
        $leadmodels = $this->_leadmodelCollectionFactory->create();

        //Start a new array
        $array = [];

        //Loop the lead models
        foreach($leadmodels->getLeadModels() as $leadmodel){
            $model = [];
            $model['name'] = $leadmodel->getLeadModelName();
            $model['id'] = $leadmodel->getId();
            array_push($array, $model);
        }

        $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
        $resultJson->setData($array);
        return $resultJson;
    }
}

Am I doing this wrong? How am I supposed to get CRUD data from a model in the controller to pass back to my ajax request?


texts: Magento 2: Show Tax amount in Product View

texts:
I'm trying to show the Tax Amount in Product View. I've set the TAX to including TAX in Calculation Setting.

I wanna show the Tax amount like this.

and I've Create the Tax Rate & Tax Rule.

I try to use this code in my Block, but I got nothing.

public function getPriceInclAndExclTax(int $productId): array
{
    $product = $this->productRepository->getById($productId);

    if ($taxAttribute = $product->getCustomAttribute('tax_class_id')) {
        // First get base price (=price excluding tax)
        $productRateId = $taxAttribute->getValue();
        $rate = $this->taxCalculation->getCalculatedRate($productRateId);

        if ((int) $this->scopeConfig->getValue(
                'tax/calculation/price_includes_tax',
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE) === 1
        ) {
            // Product price in catalog is including tax.
            $priceExcludingTax = $product->getPrice() / (1 + ($rate / 100));
        } else {
            // Product price in catalog is excluding tax.
            $priceExcludingTax = $product->getPrice();
        }

        $priceIncludingTax = $priceExcludingTax + ($priceExcludingTax * ($rate / 100));

        return [
            'incl' => $priceIncludingTax,
            'excl' => $priceExcludingTax
        ];
    }

    throw new LocalizedException(__('Tax Attribute not found'));
}

I try to print getPriceInclAndExclTax()

Array ( [incl] => 0 [excl] => 0 )


texts: How to restrict free shipping if the minimum order value below as defined after coupon code apply in Magento 2?

texts:
I have enabled free shipping when minimum order value above $500. Which is working fine.

but if customer applied any discount coupon and total order value below $500 then free shipping should not apply because grand total is less than $500.

For now, Free shipping still applying because Subtotal is still greater than $500.

Can anyone help me how to remove free shipping if Grand total less than $500 after applying discount coupon?


texts: 404 page while going to Admin CMS -> Pages

texts:
After deleting a store from admin, I am getting redirected to 404 error page when go to cms pages,
I have tried to solve this by Using the Query provided in magentocommerce thread
DELETE FROM cms_page_store WHERE store_id NOT IN (SELECT store_id FROM core_store)

There were some entries in that table which were related to the deleted store and deleted,
But the problem still remains.


texts: Single url for a product which is in different category in magento 2

texts:
I have a product black-jacket under the category men->tops
when i click on men the url is like http://magento2/men/black-jacket.html
and if i click on tops under the men then the url is http://magento2/men/tops/black-jackets.html
i want the url like http://magento2/tops/black-jacket.html on the click of both the menu in magento 2.
please suggest me, i tried to do it with url-rewrites.


texts:
My extension has stopped working since updating to Magento 2.2.0

When running di:compile we get the following error:

Errors during compilation:
    Vendor\Module\Model\ResourceModel\CollectionUpdater\Option
            Incompatible argument type: Required type: \Vendor\Module\Model\ResourceModel\collection. Actual type: \Magento\Catalog\Model\ResourceModel\Product\Option\Collection; File:
/public_html/app/code/Vendor/Module/Model/ResourceModel/CollectionUpdater/Option.php

    Vendor\Module\Model\ResourceModel\CollectionUpdater\Value
            Incompatible argument type: Required type: \Vendor\Module\Model\ResourceModel\collection. Actual type: \Magento\Catalog\Model\ResourceModel\Product\Option\Collection; File:
/public_html/app/code/Vendor/Module/Model/ResourceModel/CollectionUpdater/Value.php

Total Errors Count: 2

  [Magento\Framework\Validator\Exception]
  Error during compilation

When checking exceptions.php we get the following error:

  main.CRITICAL: Notice: unserialize(): Error at offset 0 of 169 bytes in /public_html/app/code/Vendor/Module/Model/StockProvider.php on line 181 {"exception":"[object] (Exception(code: 0): Notice: unserialize(): Error at offset 0 of 169 bytes in /public_html/app/code/Vendor/Module/Model/StockProvider.php on line 181 at /public_html/vendor/magento/framework/App/ErrorHandler.php:61)"}

No product can be added to the cart and the plugin isn't loading correctly on the product admin pages.


texts: Magento 2: show price with another attribute in one box (button)

texts:
I want to add price with attribute in one button like in the bellow image.

Magento version of shop is 2.3.4. I want to show the price with estethics attribute in a single box (button) like in the image that is above.
Is there a way to do this from admin? Or I need to change some code? Thank you.


texts: Adding a static block below product listings

texts:
I want to add a static block below product listings, this is mainly for SEO purposes, we would prefer to do this in admin if possible as opposed to the back end on the server.

We are retailers NOT experts so layman's terms please.


texts: Customer Reviews is not showing up on Product Detail page in magento 2.1.7

texts:
I am using Magento 2.1.7 version
On product detail page Review form is showing but customer reviews and their rating is not showing.
I checked in front-end this div is empty

i also checked this Reviews not showing up on Product View (after upgrade from Magento 2.1.3 to 2.2.3)
but no one answered here.

I also follow this
Magento 2.2 move review tab below description with all product reviews
But not getting proper answer.


texts: I am about to launch an eshop and I am thinking to disable reviews. How useful do you think are product reviews?


texts: Install Magento2 using different MySQL port

texts:
I have MySQL server running on a different port than the default one.

Suppose, the default port for MySQL is 3306. I have another MySQL server running on port 5625. I want to install Magento2 using MySQL database from port 5625.

While installing Magento2, I can only specify hostname, username, password and database name.

How can I specify port number as well at the time of installation?


texts: Fatal error after instantiating block in Magento

texts:
I am trying to load in a block using ajax in Magento. To accomplish this the controller needs to create a block and pass through an array of data to the block's template. This part is quite simple and I have it working.

However, the template that gets called is also trying to call a block and setData:

$this->getChild('customerfriends.event.edit')->setData(
    'event', $event);
echo $this->getChild('customerfriends.event.edit')->toHtml();

$this does not seem to be an object which is causing a fatal error.

Is there something that I need to put in my class?

class Namespace_Mymodule_Block_Event_Listsection extends Mage_Core_Block_Template
{

}


texts:
how to make magento generate order number by year and month and increment number
for example if we in August 2017 so the order numbers to be  1708001 , 1708002 , 1708003 , 1708004 , 1708005 , 1708006 , 1708007
and so on
thanks


texts: Where is content of getChildHtml('left') ?>?

texts:
I have a question about the file 2-columns-left.phtml of my blog of my theme Legenda. I want edit the title of my block-blog-categories but without success.

I see that the content of block is in the

<div class="col-left sidebar col-sm-4 <?php if(Mage::app()->getFrontController()->getRequest()->getModuleName() != 'blog'):  ?>col-md-3<?php endif; ?>">
    <?php echo $this->getChildHtml('left') ?>
</div>

Now, where is the file that is recalled from getChildHtml('left')? How should I do for edit the title of "Blog Categories"?


texts: Grouped Product Display a sum of all associated products stock

texts:
I search everywhere but cannot find a good answer.

In my 1.9 magento rwd theme, I set for single product to display the stock qty after stock status, but when i put some simple products to a grouped product type then in the table of grouped products I can see the correct stock qty and in main window i see and is display for total group stock qty = 0

This is my code:

  rwd\default\template\catalog\product\view\addtocart.phtml

<?php if($_product->isSaleable()): ?>

    <?php if ($this->displayProductStockStatus()): ?>
    <?php if ($_product->isAvailable()): ?>

<?php echo $this->__('Cantitate disponibila :') ?> <?= (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?> <?php echo $this->__('buc.') ?>

    <?php else: ?>

<?php echo $this->__('Cantitate disponibila :') ?> <?= (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?> <?php echo $this->__('buc.') ?>

        <?php echo $this->__('Availability:') ?> <?php echo $this->__('Out of stock') ?>

<?php echo $this->__() ?>Stoc Furnizor
Comanda telefonic 0785.737.227

    <?php endif; ?>
    <?php endif; ?>
    <?php echo $this->__('COD PRODUS: ') ?><?php echo $_product->getSku() ?>

    <?php echo $_product->getAttributeText('transport_01') ?>

Please see the image:

Can someone help me or to display total stock of asociated products or to hide only the main stock code.???


texts: how to put temporary index.php file to my server?

texts: Even, my Magento stopped working, we are running out of space on the server. In this case need to put index.php file to on my server how?


texts: Change minimum password length for customers in SOAP API

texts:
TL;DR: how do I change the minimum password length requirement for customers created via the SOAP v2 API?

I need to change the minimum password length requirement for customers created via the SOAP V2 API but can't find which file(s) I need to edit. I've tried using grep to check for occurrences of the password length being checked but only found the front-end code for that. It seems like there is some mapping between the SOAP layer and the model layer I'm not aware of, any pointers would be appreciated.

EDIT: So I realised that I was using grep with the case sensitive mode, which was excluding everything, since all the soap files are named Soap.php. Still looking, though.


texts: Magento 2 - php 7.2 - The each() function is deprecated in AbstractCollection.php

texts:
I am getting below error in Magento 2.1 using PHP 7.2.

  main.CRITICAL: Exception: Deprecated Functionality: The each() function is deprecated. This message will be suppressed on further calls in /vendor/magento/module-eav/Model/Entity/Collection/ on line 803 in

list($tableAlias, $tableName) = each($table);


texts: Upload image equal media gallery Magento 2

texts:
$fieldset->addField('media_gallery', 'note',
        [
            'label' => '',
            'title' => __('Media Gallery'),
            'name'  => 'media_gallery',
            // 'required' => true,
            'text'      => $this->getContentHtml(),
        ]
    );

    $fieldset->addField('media_gallery_mobile', 'note',
        [
            'label' => '',
            'title' => __('Media Gallery For Mobile'),
            'name'  => 'media_gallery_mobile',
            // 'required' => true,
            'text'      => $this->getContentHtml(),
        ]
    );

I have two fields like this in form, how can I save 2 different photos, hope anyone help me. Thank you.


texts: Magento 1 autoindex:error /skin/frontend

texts:
We get some php errors in our server log, that the DirectoryIndex could not be found in /skin/frontend/theme/theme/. But that seems to be right.

That error only display sometimes and on different pages.

Anyone who knows why we get this error?

[Wed Mar 14 09:57:32.323561 2018] [autoindex:error] [pid 29638] [client IP:33912] AH01276: Cannot serve directory /home/user/domains/domain.com/private_html/skin/frontend/theme/theme/: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive, referer: https://www.example.com


texts: How can I disable filter "category" from Sidebar

texts:
I choose my Category XY and get the Product-Grid, on the left side there is the Sub-navigation and below the "Filter Navigation".

The attribute filters starts with "categories", "manufacturer", "size", ..

How can I disable/remove the filter "categories" from sidebar?

I tried per CSS with

#narrow-by-list dt:first-child {display:none;}

but I cannot remove the categories itself. In which XML I have to remove some blocks? I have no idea ..  Thanks for your help.


texts: How to enable custom admin theme in Magento 2

texts:
I have followed the instructions here: How to create admin theme for Magento2

and here: How to change backend admin theme in Magento 2.0.7 +

and I still dont understand what I'm supposed to do to get my theme to show up in the backend. I have created my theme in app/design/adminhtml/Vendor/themename and its got a theme.xml and a registration.php (same as my frontend theme, which is working nicely). However, the above instructions talk about about a etc/di.xml which I have no idea where to place (or is that even the solution?)

Googling has got me absolutely nowhere, Magento 2 official docs suck (as always) so no help there.

So, summa summarum: how to enable my custom admin theme?


texts: How to configure postman with magento 1.9 complete beginner

texts:
I don't know how to configure my Magento 1.9 with the postman.

I don't know how to check my API for postman (or any else).

I need to complete my work within 1 day but I don't know anything about these please help me step by step.


texts:
What i want that,when customer goes on checkout page generally select shipping method but if he came back to cart then again go to checkout in that case shipping should be reset.

But Magento 2 generally do,it keeps the data in cache when we go to checkout then if again come back then it load from there.

Could any one know about this how we can approach it?


texts: Patch SUPEE-10415 applied but Form Key Validation message still appears

texts:
Patched Magento Open Source 1.9.3.6 with SUPEE-10415.

Message:

Formkey validation on checkout disabled. This may expose security risks. We strongly recommend to Enable Form Key Validation On Checkout in Admin / Security Section, for protect your own checkout process. still appears.

What to do?


texts: Magento 2 fails to generate the sitemap.xml. I get Unable to generate the sitemap

texts:
Magento 2 fails to generate a sitemap, getting the error below in my debug.log
[2020-08-21 15:09:14] main.CRITICAL: Exception message: SQLSTATE[42000]: Syntax error or access
violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 4, query was: SELECT `e`.*, IF(at_status.value_id > 0, at_status.value, at_status_default.value) AS `status`, `bct`.`visibility` FROM `blackbird_contenttype_entity` AS `e`
 INNER JOIN `blackbird_contenttype_entity_int` AS `at_status_default` ON (`at_status_default`.`entity_id` = `e`.`entity_id`) AND (`at_status_default`.`attribute_id` = '155') AND `at_status_default`.`store_id` = 0
 LEFT JOIN `blackbird_contenttype_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '155') AND (`at_status`.`store_id` = 1)
 INNER JOIN `blackbird_contenttype` AS `bct` ON (bct.ct_id=e.ct_id) AND (bct.visibility = '1') WHERE (IF(at_status.value_id > 0, at_status.value, at_status_default.value) = '1') AND (())

Does anybody know why this would happen?


texts:
Due to reasons relating to cache I need to programmatically increment the product view count on a Magento site. I have a Jquery function that does an ajax call after page load. This then calls a controller action.
I'm not exactly sure what to do in the controller. So far I was thinking of calling the product view count like so:

   $productView = Mage::getResourceModel('reports/product_collection')
        ->addFieldToFilter('entity_id', $id);

Then

    $view =$productView->getData('views);
    $view++;

Then somehow save $view.

Firstly I'm not sure if $productView is populating because I can't var_dump it but I know this call normally works so I assume it is. My big question is on how to then save the recalculated $view variable.


texts:
Can anyone let me know if we can Reorder in Magento2 using REST webapi? Actually i have made one api and used same code as magento default reorder does, here is my code in API function using order_id as parameter:

public function reOrder($orderId)
    {
        $order = $this->orderApiRepository->get($orderId);
        $cart = $this->cart;
        $items = $order->getItemsCollection();
        foreach ($items as $item) {
            try {
                $cart->addOrderItem($item);
            } catch (\Exception $e) {
                throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
            }
        }
    }

The issue is when i am checking response in postman, it returns null instead cart data, please let me know if anyone has done same type of things. please check below screenshot of POSTMAN api:


texts: Saving CMS block/page from collection removes store ID's

texts:
I need to go through all CMS pages and CMS blocks to update something, so I'm loading a collection for both of them.

After doing stuff to their content I try to save the individual items. They get saved, but all records in the store tables are removed afterwards and the pages and blocks are not associated with any stores anymore.

How can I do this and keep the stores intact?

For pages:

$pages = Mage::getResourceModel('cms/page_collection')
    ->addFieldToFilter('content', array('like' => '%something wrong%'));
foreach ($pages as $page) {
    /* @var $page Mage_Cms_Model_Page */
    $page->setContent(
        str_replace('something wrong', 'something right', $page->getContent())
    )->save();
}


texts: Attention something went wrong - default view original state errors magento 2

texts:
Getting a lot of errors recently and finally found something in the logs but not able to solve it. Already saw other post with clearing the ui_bookmark table and changing FulltextFilter.php file but no result.

  Terminated request GET
  x.hypernode.io/index.php?namespace=sales_order_view_rma_list_grid&search=&filters%5Bplaceholder%5D=true&paging%5BpageSize%5D=20&paging%5Bcurrent%5D=1&isAjax=true
  because client at 213.127.64.175 is already gone

looks like it's only happening in firefox


texts: Impact of moving Magento 2 website from MySQL 5.7 to MySQL 5.6

texts:
I have developed a Magento 2.1.x website on my local server, which has MySQL version 5.7.

Now, the server where I need to deploy the website has CentOS 6, which supports MySQL version 5.6.

My question is whether there will be any issues if I migrate my Magento 2 website from a server having MySQL 5.7 to another server which has MySQL version 5.6?

Note: I have checked the official documents of Magento 2.1.x and found that Magento 2.1.x is compatible with MySQL 5.6 and MySQL 5.7 both.


texts: Layered navigation and categories filter

texts:
I'm using multiple layered navigation filter (https://github.com/SlavaYurthev/MultipleLayeredNavigation-M2) is allows to select multiple categories at once. But categories filter is not working, I want to filter by subcategories. In Model\Layer\Filter\Category there is

$collection->addCategoriesFilter2(['in' => $values]);

but this code doesn’t add condition to sql where. I think problem is that this function is already used to add parent category filter. So calling this function twice do nothing and ignores. When I created duplicate of this function with  new table alias (cat2) it is working:

public function addCategoriesFilter2(array $categoriesFilter)
{
    foreach ($categoriesFilter as $conditionType => $values) {
        $categorySelect = $this->getConnection()->select()->from(
            ['cat2' => $this->getTable('catalog_category_product')],
            'cat2.product_id'
        )->where($this->getConnection()->prepareSqlCondition('cat2.category_id', ['in' => $values]));
        $selectCondition = [
            $this->mapConditionType($conditionType) => $categorySelect
        ];
        $this->getSelect()->where($this->getConnection()->prepareSqlCondition('e.entity_id', $selectCondition));
    }
    return $this;
}

Am I right, this is the problem?

My second question is Preprocessor class is this module (Plugin\Model\Adapter\Mysql\Filter). What is it used for? I see it adds some conditions to categories and price filter. Why it adds only for this fields and e.g. not for attributes fields? With this code commented it like it is also working.

Thx for any help.


texts: Which of these Magento statements is correct?

texts:
I am doing some M2 fundamentals online training, the system is telling me that one of these answers is incorrect...

Question 1: Which of these directives will assign a template to a block in a layout xml file

Answer 1 : <block template="test.phtml">

Question 2 : Which block methods are available in a template?

Answer 2 : Only public methods.

I have tested both of these and they both seem to be right. Is it a trick question ?

Can anyone shed some light before I tear my hair out?


texts: Add Javascript for cms_index_index only via local.xml

texts:
Why can't I add js directly via local.xml but instead have to enter it in the backend cms layout tab? I can reference head in , so for example this will work:

<reference name="head">
    <action method="addLinkRel"><rel>canonical</rel><href>http://www.domain.com/</href><action>
</reference>

While this won't:

<reference name="head">
    <action method="addItem"><type>skin_js</type><name>js/jquery.slides.js"></name><params/></action>
    <action method="addItem"><type>skin_js</type><name>js/jquery.carouFredSel.js"></name><params/></action>
</reference>

Is this behavior intended?
Thank you!


texts: Unable to unassign the category of a product in backend magento 2

texts: I wish to unassign the categories of a product in admin end. After unassigned the categories, I have saved the product. But the saved changes is not applied. Please provide me a solution to solve this


texts: In magento 2 how can i give discount to product if particular category's product exist in cart?

texts:
In Magento 2 I am want to give a 15% display to the product which do not exist in the "member" category but in cart must be 1 product available which is from the "member" category. and customers must be login into their accounts.
3rd condition is customer must not have member number in there account. for member number i have created custom field in registration form and stored into admin so if customer do not have member number then i will give 15% discount.
Example: In cart, we have 2 product "A" and "B"
Product "A" is added into the "member" category.
Product "B" is not added to the "member" category.
Now I want to give a 15% discount to product "B" if Product "A" exists in the cart.
I have written code in the "checkout_cart_product_add_after" event my code is partially working after login.
Scenario 1: if I will add first Product "A" which is from the "member" category and then if I will add Product "B" I can see a 15% discount in the cart to product "b".
Scenario 2: If I will add Product "B" first and then if I will add Product "A"  then my code is not working customer is not getting a 15% discount.
I have written the below code in the observer.
    if ($this->_customerSession->isLoggedIn()) {

    $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();
    $ids = array();
    foreach ($items as $item) {
        $productid = $item->getProductId();
        $product = $objectManager->create('Magento\Catalog\Model\Product')->load($productid);
        $categoriesIds = $product->getCategoryIds(); /*will return category ids array*/
        foreach($categoriesIds as $categoryId){
            $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($categoryId);
           $id = $cat->getId();
             if($id == '12')
           {

                $ids = '12';
           }
        }
    }
                    $item = $observer->getEvent()->getData('quote_item');
                    $item = ( $item->getParentItem() ? $item->getParentItem() : $item );
                    $product = $item->getProduct();
                    $attributeval = $product->getResource()->getAttribute('exclude_membership')->getFrontend()->getValue($product);
                    $exclude_from_15_discount = $product->getResource()->getAttribute('exclude_from_15_discount')->getFrontend()->getValue($product);
                    //$logger->debug($attributeval);
                    //$subtotal = $item->getQuote()->getSubtotal();
                    //$membersubtotal=$subtotal*100/10;
                    //exclude_from_15_discount
                    if($ids == "181")
                    {
                        if($exclude_from_15_discount == "No"){
                            $price=$item->getPrice();
                            $finalprice=$price -$price*15/100;
                            $item->setCustomPrice($finalprice);
                            $item->setOriginalCustomPrice($finalprice);
                            $item->getProduct()->setIsSuperMode(true);

                        }
                }

    }

So please let me know how can I resolve this issue.
Thanks


texts: Can we display login customer name on home page using theme template file and not using block? - Magento 2

texts: I tried to display login customer name using observer, block and controller. All working fine but when I try to display name using theme template file and it is not working. Can we do using theme template only? If yes then how?


texts: Custom adminhtml product tab with product attributes

texts: Is there a way to create a new custom tab in the backend product edit page and then add certain attributes to that tab without using a .phtml file and without creating a custom group and assigning the attributes to the custom group?


texts: Bundled Products Showing as "In Stock" but "Only 0 Left"

texts:
I was wondering if someone could help with this issue? I have 3 sites all running Magento C.E. 1.9.0 and the issue appears on all.

For my Bundled Products the Availability shows as "In Stock", however, it says "Only 0 left"

Here is a link to a product with the issue:  http://airwavewirelessnetworks.com/access-points/ap110.html

I appreciate any insight on how to solve this problem.

Thanks!


texts: Dynamically instanciate class with arguments

texts:
I am actually trying to instanciate a class dynamically with these arguments.
Here is the code I use in class A:

/** @var string $source */
$source = '\Foo\Bar\My\Class'; // Dynamic value that I am not aware because it is from other extensions

/** @var bool $isClassLoadable */
$isClassLoadable = $this->definedClasses->isClassLoadable($source);
if (!$isClassLoadable) {
    return false;
}

/** @var Model $model */
$model = $this->getModel(); // loaded model with data

/** @var \Magento\Framework\Simplexml\Config $config */
$config = $this->getConfig(); // loaded configuration with data

/** @var ProcessorInterface $processorInstance */
$processorInstance = $this->objectManager->create(
    $source,
    [
        $model,
        $config,
    ]
);

The \Foo\Bar\My\Class class code:

public function __construct(
    Model $model,
    Config $config
) {
    $this->model = $model;
    $this->config = $config;

    \Zend_Debug::dump($this->model->debug());
    \Zend_Debug::dump($this->config);
}

Here my two parameters are an empty model and an empty configuration.

Questions
- Is it a good practice to use ObjectManager to create class from a "string" ?
- If it is a "good practice" what is the way to keep my data between my class A and the \Foo\Bar\My\Class instanciation ?

EDIT
I am aware that using ObjectManager is a bad practice and Factory are here to avoid that but the $source is from a configuration and maybe third part extensions, I don't know his value. I hardcoded it for the purpose of my example.


texts: Unable to view SSL certificate on magento frontend

texts: I'm unable to view my SSL certificate on Magento frontend, i tried to change secure and unsecured url but still im getting like this. please anyone help me about this issue. im using 1.9.2.2 version


texts: How to get the order items and quote items whenever create order from admin panel?

texts:
I would like to get the items that added via admin panel in the order page.
I have created the observer to listen to Create New Order button event like this :

public function execute(Observer $observer)
{
    $event = $observer->getEvent();
    /** @var OrderInterface $order */
    $order = $event->getOrder();
    /** @var OrderItemInterface[] $orderItems */
    $orderItems = $order->getItems();

    /** @var Quote $quote */
    $quote = $event->getQuote();
    /** @var  CartInterface[] $quoteItems */
    $quoteItems = $quote->getItems();

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $logger= $objectManager->create('\Psr\Log\LoggerInterface');
    $logger->debug('Fabelio Observer::');
    $logger->debug('Fabelio Observer:: item id = ' . $quoteItems[0]->getId());
    $logger->debug('Fabelio Observer:: order item sku ' . $orderItems[0]->getSku());

    $this->quoteSubmitBeforeProcess->processSales($quoteItems,$orderItems);

    return $this;
}

When I try to create new order in the admin panel I got :

  Fatal error: Uncaught Error: Call to a member function getId() on null

Now I know that the $quoteItems = $quote->getItems(); giving me a null value.

So How to get the quote items and order items from admin here ? I successfully getting the data from front-end side but not in the admin side .


texts: Is there a mechanism built in to Magento 2 to re-auth orders with vaulted credit cards?

texts:
I am working on building what is essentially a custom pre-order module. I am using Braintree as the payment gateway, and requiring for pre-orders that a customer uses a vaulted credit card for payment.

The situation is fairly typical, which is that the original auth may fall off before the order is actually ready to ship (before the fulfillment house has inventory). Once the fulfillment house notifies Magento that it has inventory, before we send the order to the fulfillment warehouse to be shipped we need to re-auth the credit used for the order to ensure that the funds are still available and to ensure that once the order is shipped we'll be able to collect / capture payment.

Looking at Magento 2's Payment and Order classes, it SEEMS like perhaps this functionality should be easy ( 1. cancel / void previous auth 2. create a new auth transaction ), but I can't seem to find where the appropriate place for this functionality might be.

Thank you!


texts: What table links a simple product to a configurable product

texts:
I have imported some products and for some items, I can see all the children linked in the associated tab but for some others, I can only see one or 2 of the options.

If I do

select * from catalog_product_super_link where parent_id = {my parent id}

Then it shows ALL the correct product ids linked. Is there another table which links the two?


texts: Changing backend_type on attribute leads to indexing problems

texts:
I am working with a client that has some very large multi-select lists, large enough that they exceeded the 255 character limit of varchar. After some investigation I found a number of people that said they resolved this by changing the backend_type in the eav_attribute table from varchar to text. I did the same and after some testing things worked great.

Fast forward a few weeks. It was brought to my attention that the attribute that I did this to is no longer showing as a viable filter in layered navigation. After some investigation I've come to find that when the layered nav is built, it is unable to find products that would be applicable for this filter. If I changed the backend_type back to varchar and reindex, it starts working again. Change it to text and reindex, starts to fail.

I have reimported my product catalog with the backend_type set to text thinking that maybe it was just because of some weird ghost data. No luck. I have also tried updating the table using updateAttribute rather than just manually changing at the DB level thinking maybe there was some background processing that happened that I missed, no change.

So at this point I'm stuck in a situation where I need to store a lot of values in a multi-select array, in this case the largest is currently 341 characters, but I also need it to be usable as a layered nav filter which as near as I can tell does not work with text fields but will work with varchar.

Any suggestions?