texts: magento 2.4 issue creating configurable product programmatically

texts:
i am using the below code to create a configurable product from product sku (from attributes color and size), it is working fine when all associated products have both attributes - color and size
Issue comes one Attribute is not there in all associated product.
For eg
Case 1: works fine
SKU 1 : Size - L and Color - Red
SKU 2 : Size -M and Color - Black
Case 2: Add to cart not working as both associated product have one attribute Color missing as both associated product
SKU 1 : Size - L
SKU 2 : Size -M
Case 3: Add to cart not working as both associated product have one attribute Size missing as both associated product
SKU 1 : Color - Red
SKU 2 : Color - Black
Also i get the below error in the admin when I try to edit the configurable product in CASE 2 and CASE 3
Notice: Undefined offset: 0 in /usr/share/nginx/zodiac/html/vendor/magento/module-configurable-product/Model/Product/Type/VariationMatrix.php on line 49
Exception in /usr/share/nginx/zodiac/html/vendor/magento/framework/App/ErrorHandler.php:61

Code as below :
    $product = $objectManager->create('Magento\Catalog\Model\Product');
    $product->setTypeId('configurable')
            ->setStatus(1) // 1 = enabled, 2 = disabled
            ->setAttributeSetId(4) // 4 = default
            ->setName('Configurable test product')
            ->setSku('config')
            ->setPrice(0)
            ->setTaxClassId(2) // 0 = None, 2 = Default product tax class
            ->setCategoryIds(array(2)) // 2 = Default category
            ->setDescription('test description')
            ->setShortDescription('test short description')
            ->setUrlKey('configurable-test-product')
            ->setWebsiteIds(array(1)) // 1 = Default Website ID
            ->setStoreId(0) // 0 = Default store ID
            ->setVisibility(4); // 4 = Catalog & Search

    $product_resource = $product->getResource();
    $color_attribute = $product_resource->getAttribute('color');
    $size_attribute = $product_resource->getAttribute('size');
    $color_attribute_id = $color_attribute->getId();
    $size_attribute_id = $size_attribute->getId();
    $configurable_attributes = array('color', 'size'); // put here all configurable attributes you need and get their attribute IDs like I showed above
    $product->getTypeInstance()->setUsedProductAttributeIds(array($color_attribute_id, $size_attribute_id), $product); // assign attributes to configurable product

    $configurable_attributes_data = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
    $product->setCanSaveConfigurableAttributes(true);
    $product->setConfigurableAttributesData($configurable_attributes_data);

    $child_product_skus = array('SKU1','SKU2');
    $child_ids = array();
    foreach ($child_product_skus as $child_product) {
        echo "<br>".$child_product;
        $child_ids[] = $objectManager->get('Magento\Catalog\Model\Product')->getIdBySku($child_product);
    }
    print_r($child_ids);
    $product->setAssociatedProductIds($child_ids);
    $product->save();


texts:
Let's say we add some new resources to the ACL like so:

<acl>
    <resources>
        <admin>
            <children>
                <catalog>
                    <children>
                        <search>
                            <children>
                                <import translate="title">
                                    <title>Import</title>
                                </import>
                                <export translate="title">
                                    <title>Export</title>
                                </export>
                            </children>
                        </search>
                    </children>
                </catalog>
            </children>
        </admin>
    </resources>
</acl>

We then add the following around a button that appears in the SearchTerm grid:

if (Mage::getSingleton('admin/session')->isAllowed('catalog/search/import')) {
    $this->_addButton('import', array(
        'label'   => 'Import Search Terms',
        'onclick' => "setLocation('".$this->getUrl('*/*/import')."')"
    ));
}

If I then log in as a non-admin user, I would really have thought that the expected behavior would be no button visible, since I haven't explicitly given the users role the resource. As it turns out though, the default return value of isAllowed appears to be true. To compound matters, when you go and view the resources for that role, the checkbox will not appear ticked.

I can resolve the 'issue' by clicking through each role and clicking save, but this is a PITA to do especially across live / stage / dev environments. Is there any easy way to auto deny this resource from each role via code? I don't mind adding a migration script if required. I had a quick look at what happens in the same action. Presumably, I could do this by loading all roles, looping through them and performing similar logic to Mage_Admin_Model_Resource_Rules::saveRel inserting the rows into the table. But this code appears to assume that all resources are posted, which would mean in order to invoke it directly I'd need to work out what format I need to pass it data in and possibly load existing resource too.


texts: Creditmemo - Custom refund amount PER product

texts:
I'm working on Magento Credit-memo. I want to Refund product BUT with custom price INSTEAD of product's price.

Here I've added a Column for Entering a Custom refund price.

Can any one suggest, what the next STEP should be ?


texts: Search Problem when "1" is present in query string

texts:
Suppose I have 3 products (mix 1, mix 2, mix 3) in my store. Now when I search for "mix" all three products showing. When I search for "mix 2", "mix 2" product is showing, when search for "mix 3", "mix 3" product is coming, But when I search for "mix 1" all three product is showing.

I have changed the following code in
app/code/core/Mage/catalogsearch/model/Resource/Fulltext.php file

from

$likeCond = '(' . join(' OR ', $like) . ')';

to

$likeCond = '(' . join(' AND ', $like) . ')';

and only name attribute is searchable in quick search and in admin section "like" selected for "Search Type".

Now I don't understand why all three product showing when I search for "mix 1". Please help.


texts:
frontend layout handle not working other than default.xml.

Folder structure:

Namespace
  Mymodule
   Block
   view
     frontend
       layout
         default.xml -- loading
         mymodule_index_index.xml -- not loading
   Controller
     Index
       Index.php
   etc
   ....

default.xml is loading but mymodule_index_index.xml not


texts: how to override community module in local magento1.9

texts:
I am working on updating 3rd party module with local module so i have added all updated files same in local as community module like
community module:   to local
and added updated files.But 50% people saying to write config for this local module to overide.And others saying just copy & paste updated code in local
so help me regards


texts: Plugin, get original function parameters in after method

texts:
When creating plugin (http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html) is there a way to get original parameters in after method?

I'm not sure what i can find in the first param (Interceptor)


texts: how to display a label and value of the attribute in the list of products if there is an attribute value?

texts:
I have a question about the attributes and labels. I need to label and value appear in the list of products , only those that relate to the product . I did the following in list.phtml. I entered the code:

<?php echo $_product->getResource()->getAttribute('obiem_baka')->getStoreLabel(); ?>
<?php echo $_product->getAttributeText('obiem_baka');?>

The problem is that the label is displayed is always displayed , even if no value . I need that to label displayed only when there is a value .

Thank you so much.

P.S. I apologize for the error , does not speak English .


texts: Products in Cart + Abandoned Cart feature - does it affect performance? How can I clear it out?

texts:
So once again I find myself trying to track down "add to cart" performance issues. I was looking at anything related to the cart and noticed that there is a feature in the admin panel Reports->Products in Cart that has hundreds of products that were added to the cart and Reports->Abandoned Carts that has registered users who have left items in their carts.

My question is, does this affect performance or are these simply logs?

Regardless of it it affects performance, how can this be emptied?


texts: How can I stop duplicate emails over all store views?

texts:
I have a problem in Magento.

I currently have multistores for both Wholessale and retail. The problem is that my stores allow duplicate emails over the different stores. For example, a wholesale customer could sign up to retail using their existing wholesale email. We will need this fixed.
At the minute, Magento is only blocking duplicate emails from the same store view but does not check over all stores.

I have found a block of code below but cannot seem to edit it so that it will do a check over all stores. Would someone on here be willing to help me?
See code below:

protected function _beforeSave(Varien_Object $customer)
{
parent::_beforeSave($customer);

if (!$customer->getEmail()) {
    throw Mage::exception('Mage_Customer', Mage::helper('customer')->__('Customer email is required'));
}

$adapter = $this->_getWriteAdapter();
$bind    = array('email' => $customer->getEmail());

$select = $adapter->select()
    ->from($this->getEntityTable(), array($this->getEntityIdField()))
    ->where('email = :email');
if ($customer->getSharingConfig()->isWebsiteScope()) {
    $bind['website_id'] = (int)$customer->getWebsiteId();
    $select->where('website_id = :website_id');
}
if ($customer->getId()) {
    $bind['entity_id'] = (int)$customer->getId();
    $select->where('entity_id != :entity_id');
}

$result = $adapter->fetchOne($select, $bind);
if ($result) {
    throw Mage::exception(
        'Mage_Customer', Mage::helper('customer')->__('This customer email already exists'),
        Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS
    );
}

// set confirmation key logic
if ($customer->getForceConfirmed()) {
    $customer->setConfirmation(null);
} elseif (!$customer->getId() && $customer->isConfirmationRequired()) {
    $customer->setConfirmation($customer->getRandomConfirmationKey());
}
// remove customer confirmation key from database, if empty
if (!$customer->getConfirmation()) {
    $customer->setConfirmation(null);
}

return $this;
}


texts: Upgrade from CE 1.9.1 to 1.9.2.2 produces "Can't retrieve entity config: admin/permission_block"

texts:
I have recently upgraded Magento CE from 1.9.1.1 to 1.9.2.2 and when I goto Admin > System > Permissions > Blocks, I receive an error screen with:

There has been an error processing your request
Can't retrieve entity config: admin/permission_block

How do I resolve this please?


texts: Messages Block empty on advanced search results

texts:
I disabled the redirect to cart after adding a product so users can continue from where they were, which works great on category page and search results.

But when you are on advanced search page, the "product successfully added to your cart" message doesn't appear, even though the $this->getMessagesBlock()->toHtml(); exists in app/design/frontend/base/default/template/catalogsearch/advanced/result.phtml

For example, you might add 3 products while on advanced search results, no message will appear, and as soon as you navigate to a category/product page, the success message appear for all products previously added to the cart while been on advanced search results.

Any ideas why messages are not fetched while on advanced results page? I am on Magento 1.9.3.1.

Thanks in advance.


texts: Magento 2 "More" button on poduct listing page

texts: I want more button next to swatches image and on click of more, it will redirect to the product details page


texts: how to call API in magento2 from custom module controller

texts:
I have installed an module thats working fine. I tried to run this modules API via Swagger and I am able to run from there.

Now I want to implement this modules API in my custom module and I tried below code but it didn't work and I m getting error -

$userData = array("username" => "muusername", "password" => "mypassword");
$ch = curl_init("http://127.0.0.1/git_projects/magento/index.php/rest/V1/integration/admin/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));

$token = curl_exec($ch);

$ch = curl_init("http://127.0.0.1/git_projects/magento/rest/default/V1/productAttachment");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));

$result = curl_exec($ch);

var_dump($result);

I also tried with my 'Integration' user's token that I created via admin.

But with above code I am getting error -
"{"message":"Request does not match any route.","trace":null}"

I am running above code in my controller's execute function.

Note -  Currently In API calling I am not passing any parameter. Its just for test. It should give 'parameter' respective error but its giving different error.

Please help me in this -


texts:
After I've updated a shop from 1.8.0.0 to 1.9.3.3 I'm not able to get past step 1 of the checkout. Logical explanation would be the form_key issue and I've thoroughly investigated the possibility of this causing the problems. As far as I can see it doesn't, at least not directly... Either with the form_key setting enabled or disable I get the same result: no step 2.

When I look at the console of Firefox I get this message:

Call to undefined method Mage_Checkout_OnepageController::isFormkeyValidationOnCheckoutEnabled () in app/code/core/Mage/Checkout/controllers/OnepageController.php on line 373

The referenced code looks like this:

if ($this->isFormkeyValidationOnCheckoutEnabled() && !$this->_validateFormKey()) {
  return;
}

Obviously if I delete the first part my checkout works again but this can't be solution.

Apparently I'm missing something here. Checkout is not able to verify the form_key setting or something? Anybody who has experience with this kind of issue?


texts: Magento 2: get invoice numbers(id) from order id from database

texts: Hi I want to get the invoice numbers for a single order from database. How can i query for this? Which table store this invoice numbers?


texts: Email not send when put order for recurring profile products

texts: I placed the order for recurring profile products. New order email not received. If I put the order for normal products, I received the email.How to fix this. Is any option in backend to enable this?


texts: How to Config Saved CC Payment Gateway Configuration as Live?

texts: I am checking Saved CC (Default payment Gateway) using dummy data. It's working fine but I want make it live. We can not validate dummy data in this. Where can I set merchant account Saved CC. I am very confused. Can you give step and example url for that. Means live Magento store setup this gateway.


texts: How to send confirmation email to customer and set as not confirmed customer in magento programmatically

texts:
I am trying to send this email in this observer customer_register_success

My code:

$customer = $observer->getEvent()->getCustomer();
$session = Mage::getSingleton('customer/session');
            $storeId = $customer->getSendemailStoreId();
            $customer->setConfirmation(1); //confirmation needed to register?
            $customer->save(); //yes, this is also needed
            $customer->sendNewAccountEmail('confirmation',$session->getBeforeAuthUrl(),$storeId); //send confirmation email to customer?
$session->logout();

Mail is sending but customer is set as confirmed but i want to set as not confirmed


texts: volume discount for unique customized product

texts:
In my shop (magento 1.7.0.2) customers can order cardboard cutouts with a personalized design (by uploading their picture).

I want to implement a volume discount per uniquely customized product.
For example: the customer orders
5 pieces of the product with his own picture A, and
1 piece of THE SAME product but with his own picture B
=>  then the volume discount should apply only to the 5 pieces with picture A

(reasoning behind it is, as you probably guessed, that making one piece is expensive but making a duplicate is relatively cheap).

The products are simple products with a custom option (i.c. the uploaded picture file).

How can you create such a volume pricing?


texts: Products disappearing from Category pages - Tracking down the cause!

texts:
I have an unusual problem with a range of items on my Magento store that after a few days, disappear from the category pages. If I go into the back end, disable those specific items and then re-enable them again, once Magento re-indexes the products appear again (no manual re-index required, 5 minutes later it's completed automatically by cron).
It's very difficult to track down the cause! I have tried studying the database tables to identify the product ID's which are affected (a range, 6-691 of over 3000 products) and comparing their data to products not affected, but cannot find the differences. I've also compared all the back end product data. Nothing seems to be amiss. I have been trying to hunt this down for a couple of weeks and have had to follow the procedure of disabling the products and re-enabling them 2 or 3 times, not an ideal solution. I also tried exporting all the products and re-importing and over-writing all the products concerned but no luck.

Has anyone experienced anything like this, and have you got any pointers on tracking down the cause? Are there any tools out there for Magento 2 which could possibly help identify problems like this by analyzing the database?


texts: Is it safe to manually make System redirect to RP in Magento?

texts:
Is it safe in Magento to update the target path and Options using some sql query?

Suppose in the attached screenshot if I update the highlighted target path to contacts.html and options to RP ( 301 Redirect ) what can be the adverse effects?

Is it a safe practice?


texts: How to add dynamic custom column in UI component

texts:
I have configured UI component columns in admin grid and its working fine. I need to add custom columns dynamically.

For example we can add custom column in __prepareColumns function in Block layout

My Question is will add custom column in UI component approach

UI component xml:

<column name="custom_column" class="Simple\Test\Ui\Component\User\Column\CustomColumns">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <!--item name="filter" xsi:type="string">text</item-->
                    <item name="label" xsi:type="string" translate="true">Custom Column</item>
                    <item name="component" xsi:type="string">Simple_Test/js/grid/columns/customcolumns</item>
                </item>
            </argument>
        </column>


texts: magento 2 cart price rule for Buy X Get Y

texts:
I need to know Cart price rule for Buy X and Get Y
I have 3 rules using Buy X and Get Y
1.Buy 1 Get 1 (third priority)
2.Buy 2 Get 2 (second priority)
3.Buy 3 Get 3 (first priority)
First Buy 3 Get 3 satisfies then others will no need to apply,the one rule only will apply,
second Buy 2 Get 2 satisfies then others will no need to apply,
First Buy 1 Get 1 satisfies then others will no need to apply
Is this possible ?


texts:
How to create Inline Edit in grid? I need controller file or only do this in  view ui_component?

I created this in ui_component but not working

<item name="childDefaults" xsi:type="array">
<item name="fieldAction" xsi:type="array">
    <item name="provider" xsi:type="string">test_mytesting_index.test_mytesting_index.test_mytesting_columns_editor</item>
    <item name="target" xsi:type="string">startEdit</item>
    <item name="params" xsi:type="array">
        <item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
        <item name="1" xsi:type="boolean">true</item>
    </item>
</item>


texts: Magento 2 backend - tables en layout not fully loaded

texts:
On a Magento 2.1.5 installation our backend layout is suddenly very odd.
Tables are not complete, the navigation bar scrolls over content and some other CSS/JS related issues. Updated to 2.1.5, but didn't fix the issues. Upgrade and compile commands ran several times, as well as emptying caches. Present in all browsers.

Anyone experienced the same issues?


texts:
I want to change a CSS style and position for product name, price, brand name and reviews on products card.

Here is current CSS style:

Here is the look that I would like to get

Anyone help me which files I should edit?

@ update

How to change style also for old price in list.phtml?

I centered all text but impossible center old price.

In list.phtml I have only:

<?php /* @escapeNotVerified */ echo __('Cena det.') ?>

<?php echo $block->getProductPrice($_product) ?>

I cannot find oldprice


texts: Log to File not found in magento 2.3.6-p1

texts:
I am trying to use log of magento 2, it's documentation said I have to set "Yes" to "Log to file" in store/configuration/developer/debug. But at there I can't find Log to file drowdown. My magento version is 2.3.6-p1. And suggestion is greatly appreciated!
Thanks


texts:
I have a Magento installation and when I apply a coupon it says.

  Discount code "XXXXXX" is not valid.

I've cleared cache, disabled cache, tried to re-index all data but still the issue is there. The log file is also empty.

Is there a way to figure out why this happens?


texts: How can I restrict customer accounts to a specific store view?

texts:
If a customer registered on a specific storeview, it has to use the account only on that storeview. So I want to turn off the shared customer accounts. If a customer tries to log in with that account on another storeview, there must be an error which says that the account doesn't exist.

Is there a way to do this?

Thanks!


texts: Magento 2 Add block before another block using XML

texts:
I want to move minicart block to top.links block.

This did the trick for me:

<move element="minicart" destination="top.links" />

Now, I added a custom block with custom .phtml file to the top.links block too:

<referenceBlock name="top.links">
            <block class="Magento\Framework\View\Element\Template" name="fw.account" template="Magento_Theme::html/FlavourWarehouseAccountDropdown.phtml"/>
</referenceBlock>

That works as expected too.

However, I need the block "fw.account" to be rendered before the "minicart". I tried adding the "before" and "after" to blocks but with no success.

How can I add the fw.account block before minicart block? Adding before="minicart" to fw.account block didn't work...


texts: Magento 2.1.6: Error filtering template: Unable to write file into directory

texts:
after install Magento 2.1.6 on Windows 10 XAMPP I got this error in the frontend homepage:

  Error filtering template: Unable to write file into directory
  \C:/xampp/htdocs/Magento/pub/media/catalog/product\cache\f073062f50e48eb0f0998593e568d857/m/b.
  Access forbidden.

I google it but I did not find any answer how to fix it.


texts: How to include files inside pub, lib folder to composer?

texts:
I am a developer myself and I built extension for Magento 2. So far it is only zip package file. User just unzip the file, uploads it to ftp and then runs php bin/magento setup:upgrade. Now I need to create also Composer option for installation so our customers can install the extension without uploading zip files but using composer.

One of the problem is that we have some files outside app folder (inside pub and lib). More than 100 files. I think that composer doesn't have option to include files outside app folder because composer will install it in vendor folder.

Is it possible to include into composer also files from lib and pub folder?


texts: Observer event after placing an order issue in Magento

texts:
This is my xml:

<global>
  <frontend>
            <events>
                <sales_quote_save_before>
                    <observers>
                        <mynamespace_mymodule_sales_quote_save_before>
                            <class>Mynamespace_Mymodule_Model_Observers_CheckoutValidation</class>
                            <method>orderValidation</method>
                        </mynamespace_mymodule_sales_quote_save_before>
                    </observers>
                </sales_quote_save_before>
            </events>
        </frontend>

    </global>

This is my observer:

class Mynamespace_Mymodule_Model_Observers_CheckoutValidation
{
    public function orderValidation($o){
        Mage::log('My log entry', null, 'mylogfile.log');
    }

BY creating the log file I just want to know if it gets there. but the file is never created. What I want to achieve is to validate some fields (address,telephone etc) in an observer. Why my log file is not created?


texts: Setup Wizard succeeds but doesn't create

texts:
I followed the easy install procedure

guides/v2.1/install-gde/prereq/zip_install.html

and used this software version:

Magento-CE-2.1.7-2017-05-30-01-54-40.tar.gz

Everything set up successfully, but when I click Launch Magento Admin on the success page, I get 404 not found. If I browse to the Magento DIR I do get a home page, but it is just plain HTML (no styles), and all links also result in 404: login, create account, my cart, etc.

Something seems to be missing?


texts: Magento 2 - cart page custom UI component foreach binding

texts:
I want to add a custom UI component template on the cart page. The data is in JSON format and wants to bind forach to display a list of data.

data like as

{'name':'5% discount','description':'5% off on purchase','coupon':'WINTEROFF5'},{'name':'15% off','description':'15% off auto-generated coupons','coupon':'WINTEROFF15'}

following error as I got

  Uncaught TypeError: Unable to process binding "foreach:
  function(){return { data:getCouponList(),as:'coupon'} }"


texts:
My store sell products as individual and as packs, but I only want to create one product.
So I was thinking about using the customization Options, but the problem is when the user selects an option, the options price gets added to the original price.

Is there any way to replace the actual price with the options price.


texts: Getting 404 Not Found Error on every page except index.php

texts:
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier.

I am getting a  "404 Not Found Error The resource requested could not be found on this server!"
getting this on every page except index.php and also not able to login into the admin panel.

I already cleared the cache memory and set the is_active option to 1 in core_website, core_store and core_storegroup tables in phpMyAdmin still getting an error... I've tried so many links to solve this issue but the problem didn't resolved till yet.


texts: How to add a widget in a variable in a static block

texts:
Hi everyone this may be silly, I want to know if it's possible to add a widget into a variable I made.

{{translate fr='' en=''}}

This is the variable. Quiet simple admin can translate static block with multiple language in only 1 static block and this is what I need. ( I can't do multiple static block for each language )

Now my question is : how can i do this :

{{translate fr='{{widget type="catalog/category_widget_link" anchor_text="À propos" title="À propos" template="catalog/category/widget/link/link_block.phtml" id_path="category/9"}}' en='{{widget type="catalog/category_widget_link" anchor_text="About us" title="About us" template="catalog/category/widget/link/link_block.phtml" id_path="category/9"}}'}}

As you can see what I'm trying to do is to have translate the widget. But it's get confuse by the {{ }}. And I end up with this :

{{widget type="catalog/category_widget_link" anchor_text="À propos" title="À propos" template="catalog/category/widget/link/link_block.phtml" id_path="category/9"' en='About us '}}

In the view instead of À propos / About us.

This is the translate function :

public function translateDirective($construction)
{

    $params = $this->_getIncludeParameters($construction[2]);
    Mage::log(print_r($params, 1), null, 'logfile.log');
    if($store_code = Mage::app()->getStore()->getCode() == 'default' || $store_code = Mage::app()->getStore()->getCode() == 'english_canada') $words = $params['en'];
    else if($store_code = Mage::app()->getStore()->getCode() == 'french') $words = $params['fr'];

    //return $words;
    return $words;

}

Any help would be really appreciated

Thx in advance!


texts: how to add some product are printable and some not in magento?

texts:
What is the use of "this product is printable"?
And some product not display icon of print.
How to implement in magento?
See design of magento layout product list page.


texts: Google CDN jQuery with Local Fallback in Magento Layout XML

texts:
I've done the following to include jQuery from Google CDN in Magento:

<default>
    <reference name="head">
        <block type="core/text" name="google.cdn.jquery">
            <action method="setText">
                <text><![CDATA[<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript">jQuery.noConflict();</script>]]>
                </text>
            </action>
        </block>
    </reference>
</default>

However when I want to implement it with a local fallback, which works quite well, I wind up adding it to my .phtml as such:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
if (!window.jQuery) {
    document.write('<script src="/path/to/your/jquery"><\/script>');
}
</script>

Is there a more elegant way of doing this in local.xml than to shove the fallback into the <text> node as I'm doing with jQuery.noConflict?

Edit:

To draw attention to the other part of the question - are there community modules that include jQuery for you? If they have a local jQuery, that's fine - if they use Google CDN - even better.  If this isn't out there, I would love to create one.

Are there any go-to extensions that handle this without me having to bootstrap it myself?


texts: Out the box is it possible to apply catalog price rules to grouped products on magento ce or ee? I've searched but cant find anything related to my question.


texts: Magento 1 : duplicate data in description and short description

texts:
Magento 1.9 based website.

i am facing a wierd issue while updating short description and description via import or manually, that data is getting duplicated i.e. when i try to update description and short description the product page shows same data as description on short description.

example : if i write 'printed skater dress' at description and 'skaters for girls' at short description and save it but on frontend it shows 'printed skater dress' at both description and short description places.

request if anyone can guide.


texts: how to apply iphone theme only for my account page?

texts:
Problem is we are using bootstrap for magento theme so we dont have to make a seperate theme for mobile devices.But we need to use "iphone" theme page of my account for mobile devices as its already responsive any ready to use.
Is it possible with magento?


texts: magento 2 Customer Report unable to set Interval(Period like 2019), Customer Group, Numbers of Orders, Average Order Amount, Total Order Amount

texts:
I am trying to create custom report and want to display admin grid with columns as below:
Interval(Period),Customer Group,Numbers of Orders,Average Order Amount,Total Order Amount

I have run the query in sql as below.

  SELECT customer_group.customer_group_code as customergroup ,count(sales_order.entity_id) as totalorder,AVG(sales_order.base_grand_total) as avgorder, sum(sales_order.base_grand_total) as grandtotal FROM sales_order,customer_group where customer_group.customer_group_id=sales_order.customer_group_id GROUP BY sales_order.customer_group_id

Below is the output:

I got the result with data. Just unable to set these in collection and display in admin grid.Below is the code of collection.php

 <?php namespace Vendor\Module\Model\ResourceModel\Product\Sold;
class Collection extends \Magento\Reports\Model\ResourceModel\Order\Collection
{
    /**
     * Set Date range to collection
     *
     * @param int $from
     * @param int $to
     * @return $this
     */
    public function setDateRange($from, $to)
    {
        $this->_reset()->addAttributeToSelect(
            '*'
        )->addOrderedQty(
            $from,
            $to
        )->setOrder('ordered_qty',self::SORT_ORDER_DESC);
        return $this;
    }

    public function addOrderedQty($from = '', $to = '')
    {
        $connection = $this->getConnection();
        $orderTableAliasName = $connection->quoteIdentifier('order');

        $orderJoinCondition = [
            $orderTableAliasName . '.entity_id = order_items.order_id',
            $connection->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED),
        ];

        if ($from != '' && $to != '') {
            $fieldName = $orderTableAliasName . '.created_at';
            $orderJoinCondition[] = $this->prepareBetweenSql($fieldName, $from, $to);
        }

    //here I am unable to get the collection
    $this->getSelect()->reset()->from(
        ['order' => $this->getTable('sales_order')],
        ['totalorder' => 'count(sales_order.entity_id)',
            'avgorder' => 'AVG(sales_order.base_grand_total)',
            'grandtotal' => 'sum(sales_order.base_grand_total)' ],
            implode(' AND ', $orderJoinCondition)
    )->joinInner(
        ['customer' => $this->getTable('customer_group')],
        ['customercode' => 'customer.customer_group_code']
    )->where(
        'customer.customer_group_id=order.customer_group_id'
    )->group(
        'order.customer_group_id'
    );

    return $this;
}

public function setStoreIds($storeIds)
{
    if ($storeIds) {
        $this->getSelect()->where('order_items.store_id IN (?)', (array)$storeIds);
    }
    return $this;
}

public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
{
    if (in_array($attribute, ['orders', 'ordered_qty'])) {
        $this->getSelect()->order($attribute . ' ' . $dir);
    } else {
        parent::setOrder($attribute, $dir);
    }

    return $this;
}

protected function prepareBetweenSql($fieldName, $from, $to)
{
    return sprintf(
        '(%s BETWEEN %s AND %s)',
        $fieldName,
        $this->getConnection()->quote($from),
        $this->getConnection()->quote($to)
    );
} }


texts: i want to create option for printing customer wishlist. I want to add at the bottom of wishlist link to printing page. It should execute Ctrl+P.


texts: Magento 1.9.2.X Gift Options for Individual Items Bug (Doesn't capture data in checkout)

texts:
I don't know if anybody is using this or anyone encountered this already, but the gift options for individual items doesn't capture the data entered in the message box upon checkout. For example, if you have more than 1 items and you would like to enter individual messages for those items.

At first, I thought it's just a bug with the IWD OPC extension. But I also tested it in a newly installed Magento 1.9.2.4 without any extension, bought items in my own store, then added separate gift messages for those two items, after checkout, the gift options message field in the admin is blank. There are no additional rows for other gift messages.

Did anyone encounter this before and how did you guys fix it? What I did is I tried other older versions of Magento, and still, it didn't work. So I think it's a bug that wasn't noticed by everyone, because this feature is seldomly used.


texts: Hide Bundle price from onepage checkout?

texts: Does anyone know where the code located that calls the bundle price next to the product title in the checkout?  I have a digital download bundle that is free but I don't want the $0.00 displayed next to it. I've looked through the item.phtml file and found nothing so far.  Thanks


texts: Can't place order after migration data from Magento 1 to Magento 2

texts: When I try place order, it show "Please choose a valid discount amount."


texts: Magento 2 MSI Get Product's Inventory Location/wareshouse on frontend

texts: How would I go about displaying a product's warehouse location on the product page? We are using MSI and would like to display which stock source the product is in stock at on the product page.


texts: Remove textfield from checkoutpage-IWD one step checkout

texts: I want to remove textfield from magento2 checkout field.i am using the IWD free one step extenstion.here with i attach the screenshot of my checkout page.(kindly refer)


texts: How to intergrate paypal in Indian website to recieve payment in INR?

texts:
we are trishlaemart we use magento 1.9. for our website.
we are looking our international customers to make payment in INR.
We tried many ways but not working, we are using EBS payment gateway for support.
which helps to get payment in paypal but the currency is not getting converted into INR

Example: 100 INR is there as product means its taking as 100 USD.

Anyone help us to solve this issue


texts: some images not showing in Magento ver. 2.1.0

texts:
Magento 2.1.0
Porto theme

I have installed Magento 2.1.0 and the Porto theme. I have made no additional changes whatsoever except I tried to clear Cache and re-index (which I guess can't be done through the Admin panel no more?)

Now what happens is - some images are completely missing such as on the Payment page - it's missing the "Acceptance Mark" (that's the alternate text for the image anyways) for PayPal Express Checkout. I'm also missing the logo in the top left hand corner of the Admin page (which I changed and then it was showing fine) and the Magento Admin Panel logo on the login into the Admin panel page.

Any ideas what I did to cause this and how to fix it and make sure these images do not go away in the future?

I will include 3 screen-shots of what I'm talking about...


texts: SSL certificate not trusted on customer login page?

texts:
When I enter my customer login page (.../customer/account/login/), I get the "ssl certificate not trusted" message. It shows https though in the browser. How can I avoid that? By adding it to the secure urls in Magento?

Thanks!


texts: How do i get the order ID and Order Subtotal in the credit memo page?

texts:
Im currently trying to write a piece of code that refunds an order and attach it to the "refund" button in the credit memo page using the "sales_order_payment_refund" event.
But, right now, I want to be able to get Order_ID and Order_Subtotal from the credit memo page of the order I have opened to proceed, how can I retrieve those 2?


texts:
I need to change all of the "http://" to "https://" in a file on my site. I did these steps. By the way, I'm using Magento 1.9.2.4 and a Chromebook -

I right clicked on my site and clicked "Inspect".
The screen splits in two, and on the right there is a message saying:

'http://fonts.googleapis.com/css?family=Arimo:400,700|Open+Sans:400,700,600italic,300|Roboto+Condensed:300,400,700'. This request has been blocked; the content must be served over HTTPS.

I click on this and get taken to this link:

http://fonts.googleapis.com/css?family=Arimo:400,700|Open+Sans:400,700,600italic,300|Roboto+Condensed:300,400,700

I right click on "view page source" and then I right click again and click "Inspect".
The screen splits in two and on the right at the top there are tabs that say "Elements, Console, Sources, Network, Timeline, and Profiles".
I clicked on "Elements", double clicked on the code I wanted to edit (you can also right click and hit "Edit Text" or "Edit as HTML"), and typed an "s" in front of all the links that say "http://" and change them to "https://".
However, there is no way to save this file where the next time I go to my site, it won't have these problems.
I tried going to the "Sources" tab and add an "s" in front of the "http://", but I can't edit this file in the "Sources" section directly.

How can I change all of the "http://" links to say "https://"?

Please give as DETAILED information as possible
Ex - Go to CPanel, click on..., scroll to the middle of ... file, etc.

Thanks!


texts: Disable hover on listing page on Magento-2

texts:
I have my custom theme using Luma as parent.

I want to disable hover effect and show only "out of stock" message.

How can I achieve this?


texts:
I'm having problems with cacheing a block in Magento 2. The theme I'm using is getting content for the block via an AJAX call.

Is it possible and if so, how to cache such a block in M2?

Thank you,
Mateusz


texts:
I need to disable customer registration.

Default, if a customer selects 'registration' in the top menu, a form appears with fields for first name, last name, email and password.

I added some fields to this form like company and telephone number, deleted the password fields and changed some texts to let the customer know he is applying for an account and will receive passwords after approval. So a mail has to be generated to inform us.

But when a customer fills out the form, he gets the message "password can not be empty"
What is the best and easiest way to solve this?


texts: Magento 2 : How can you install a Magento2 quickly to last version with sample data with composer

texts:
How can you install a Magento 2 quickly to last version with sample data with composer

Can you install a Magento2 last version with sample data with composer?


texts: Show multiple images for specific attribute in Magento 1.9

texts:
I have made a multiselect attribute called "Special"
For every value selection I have to show an image on the product page
I wrote the code below but it works only if I choose only one selection. When I choose more selections I have no image on fronted.
Any suggestions?

<?php
$_product = $this->getProduct();
$specialName = $_product->getAttributeText('special');
$specialId = $_product->getSpecial();
?>
<?php if ($specialId) : ?>

<img src="/media/catalog/special/<?php echo str_replace(' ', '_',$specialId); ?>.jpg" alt="<?php echo $specialName; ?>" title="<?php echo $specialName; ?>" />

<?php endif; ?>


texts: Is there interference between a translation dictionary and other translation files?

texts:
so I am using the mageplaza translation dictionary for French, we've installed another extension to handle pre-order. I've done collect phrases on that module and added fr_FR.csv in app/code/(vendor)/Preorder/i18n/fr_FR.csv , translated the lines I wanted.
After doing a static deploy fr_FR, reindexing, clearing/flushing cache, it doesn't seem to catch what it needs to translate. I've tried modifying a line in the dictionary which is under vendor/mageplaza/(long name with fr)/fr_FR.csv and that seems to be working.
I've tried adding the module components that we get from using the i18n-collect-phrases command on the whole installation and adding the lines that I want to the master translation file as well, for example "Preorder Information","Preorder Information",module,(vendor_app), I appended that at the nd of the fr_FR.csv found there (Where I tested modifications and it worked), and again, nothing on that front.
So I am curious if there are things that could be interfering?


texts: Magento 2 set and access variables between controllers

texts:
I have a problem with storing and accesing variables accross controllers.

i have controller 1 there i set variable ( tried registry and session )
in block of that controller i have both and registry and session variables..
then we are visiting product page and from there we go to controller 2 both session and registry variables are empty.

tried following sessions catalog and persisent

any other way to pass variables between controllers ?

so the flow is:

Controller1(set variable) -> Block1 -> Product view page -> Controller2(acces variable) -> Block2


texts: Magento 1 | how get product attribute data

texts:
Sorry for my English.

I have this code.

 $productCollection = Mage::getModel('catalog/product')
        ->getCollection()
        ->addAttributeToFilter('attribute_set_id',array(12,4))
        ->joinField(
            'qty',
            'cataloginventory/stock_item',
            'qty',
            'product_id=entity_id',
            '{{table}}.stock_id=1',
            'left'
        )
        ->addAttributeToFilter('qty', array("gt" => 0))
        ->setPageSize(500)
        ->load();

    var_dump($productCollection->getData());

I need get a product name , and I use this ->addAttributeToSelect('name') on my collection, but My collection don't return the data.

in attribute settings, I have this

How can I get all the product data in general?


texts:
So I'm running Magento 1.9.2.4 and configuring custom email templates for invoice and order emails, however when I set the logo for the email header in system > design > transaction email the HTML is drawing the logo instead from file path:

/store/skin/frontend/base/default/images/logo_email.gif

All other images such as the favicon are being drawn from my custom template file path, but its just this logo, it seems, is generating an incorrect URL. I know the base folder is like the fallback, so is there a reason the url would redirect to the base?
Thanks


texts: Magento 2: Restrict shipping method for multiple based on item address selection

texts:
Add 2 products in cart and go to multiple shipping
select different address per item and restrict shipping method based on address selection
Ex: I have to different address one is from USA and second is a different country and remove free shipping method for USA country address in multiple shipping case
Let me share if anyone has an idea for multiple shipping for place one order


texts: Magento System and Exception Log not working

texts:
I have exhausted every trick in my book. Magento will not log anything at all, to debug I inserted two log calls in index.php

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    Mage::log("WOOOOPIE");
    error_log("Go sell your fur");
}

php error_log works and logs to /var/log/apache2/error.log
{{Magento dir}}/var/log/system.log and exception.log are empty.
In the Admin panel, Under Configuration > Developer, I enabled profiler and error logging.
The entire var directory is owned by www-data and chmod'ed 777, I checked ps aux  and envvars to confirm apache is running as www-data.
All caches were cleared repeatedly, then disabled.
index.php has the default of error_reporting(E_ALL | E_STRICT); set.

Here are the permissions of system.log, I had to touch it myself.

namei -ml /var/www/nslocal/var/log/system.log`
f: /var/www/nslocal/var/log/system.log
drwxr-xr-x root     root     /
drwxr-xr-x root     root     var
drwxrwxr-x root     www-data www
drwxrwxr-x www-data ci       nslocal
drwxrwxrwx www-data ci       var
drwxrwxrwx www-data ci       log
-rwxrwxrwx www-data ci       system.log

I have even tried restarting. Without the log working I can't debug why magento isn't sending emails, despite php and sendmail working properly. Do I have a ghost?


texts: Removing CSS code from a theme using a custom theme

texts:
Im not sure this is possible but I wanted to ask.

I have a theme installed and it adds alot of CSS to the search input which breaks a custom module that also works with the search input.

I cant just overwrite the CSS using a custom.less file, i actually want to remove certain parts from the themes CSS file.  I can obviously delete lines of code from the themes own CSS files, but I was wondering if this can be done from a custom theme?

As an example, this code is in the themes CSS file;

.page-wrapper .page-header .header_right .block-search input {
    /* width: auto; */
    /* height: auto; */
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: #5C5C5C;
    background-color: white;
    color: #5C5C5C;
    font-size: 12px;
}

Is there a way to delete this content (not overwrite it) from a custom theme?


texts: Magento 2.3: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)

texts:
I'm very new to magento 2.3, I'm facing some error maybe from DB side....

Here is my code:

/app/code/EC/Customimport/Controller/Adminhtml/Index/Import.php

<?php

namespace EC\Customimport\Controller\Adminhtml\Index;

use EC\Customimport\Model\CustomimportFactory;
use Magento\Framework\Controller\ResultFactory;
use Magento\Backend\App\Action\Context;

class Import extends \Magento\Backend\App\Action
{
    protected $request;

    /**
     * @param Context $context
     */
    public function __construct(
        \Magento\Framework\App\Request\Http $request,
        Context $context,
        CustomimportFactory $modelCustomimportFactory
    ) {
        $this->request = $request;
        $this->modelCustomimportFactory = $modelCustomimportFactory;
        $this->resultFactory = $context->getResultFactory();
        parent::__construct($context);
    }

    public function execute(){
        ignore_user_abort(true);
        set_time_limit(0);

        $ids = $this->getRequest()->getParams('customimport_id');

            $model = $this->modelCustomimportFactory->create()->load($id);
            $model->import();

        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
        $resultRedirect->setPath('adminhtml/*/index');
        return $resultRedirect;

    }
}

ERROR:

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s),
query was:
SELECT `customimport`.* FROM `customimport`
WHERE
(`customimport`.`customimport_id`='true', '4', 'FrFt7XBKVOwNwaq2')


texts: Is the tabbed content in the Magento product page hurting SEO?

texts:
Is tabbed content in the Magento product page bad for SEO?
If so, how should I make it more SEO friendly?


texts: Magento 2: Skipping Shopping Cart Page after Add to Cart

texts:
I'm using Magento 2 CE Version 2.1.0.

I have Googled & also referred some StackOverflow Q&A.

I have done the following things:

app\code\Custom\Module\etc\frontend\events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch_skip_shoppingcart">
        <observer name="skip_shopping_cat_page" instance="Custom\Module\Observer\SkipShoppingCartObserver" />
    </event>
</config>

app\code\Custom\Module\Observer\SkipShoppingCartObserver.php

namespace Custom\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\App\ObjectManager;

class SkipShoppingCartObserver implements ObserverInterface {

    /**
     * @var \Magento\Framework\App\ActionFlag
     */
    protected $_actionFlag;

    /**
     * @var \Magento\Framework\Message\ManagerInterface
     */
    protected $messageManager;

    /**
     * @var \Magento\Framework\App\Response\RedirectInterface
     */
    protected $redirect;

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

    /**
     * @param \Magento\Captcha\Helper\Data $helper
     * @param \Magento\Framework\App\ActionFlag $actionFlag
     * @param \Magento\Framework\Message\ManagerInterface $messageManager
     * @param \Magento\Framework\App\Response\RedirectInterface $redirect
     */
    public function __construct(
    \Magento\Captcha\Helper\Data $helper, \Magento\Framework\App\ActionFlag $actionFlag, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\Framework\App\Response\RedirectInterface $redirect
    ) {
        $this->_helper = $helper;
        $this->_actionFlag = $actionFlag;
        $this->messageManager = $messageManager;
        $this->redirect = $redirect;
    }

    public function afterAddToCart(\Magento\Framework\Event\Observer $observer) {
        $controller = $observer->getControllerAction();
        $response = $observer->getResponse();
        echo 2;
        exit;
        $response->setRedirect(Mage::getUrl("checkout/onepage"));
        Mage::getSingleton("checkout/session")->setNoCartRedirect(true);
    }

    /**
     *     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return void
     */
    public function execute(\Magento\Framework\Event\Observer $observer) {
        $actionName = $observer->getEvent()->getRequest()->getFullActionName();
        $controller = $observer->getControllerAction();
        $controller->getResponse();
        echo 1;
        exit;
    }
}

After a product has been added to cart, it's not going neither of above function.

[UPDATE]

Thanks @Raphael for great help. It's working fine on Product Detail Page, but in listing still have issue. In listing after clicking on "Add to Cart" it's calling below services & Stays on same page. May be AJAX issue? Not sure

It keep displaying "Adding.." in Grey


texts: How can i change my homepage layout to be 2 column and 1 column at the same time?

texts:
I currently have my homepage layout set to: 2 columns with left bar.. and i want to look just like in the picture..
I've run out of ideas and i'm asking for your help..
I'm currently running on a custom theme and my magento version is 1.9.0.1

I really need your help..
Thank you


texts: Foreign key fields auto increments conflicts in magento 2 install schema

texts:
I just converted the Magento 1(created by Ultimate Module Creator) module Install script for the new magento 2 Install-Schema script, here I got some trouble.

The referencing fields also has the auto increment. Please look at the below code that should make some sense.

$table = $installer->getConnection()
        ->newTable($installer->getTable('vendor_blog_blog_comment'))
        ->addColumn('comment_id', \Magento\Framework\Db\Ddl\Table::TYPE_INTEGER, null, [
                'identity'  => true,
                'nullable'  => false,
                'primary'   => true,
            ], 'Blog Comment ID')
        ->addColumn('blog_id', \Magento\Framework\Db\Ddl\Table::TYPE_INTEGER, null, [
                'identity'  => true,
                'nullable'  => false,
                'primary'   => true,
            ], 'Blog ID')
        ->addColumn('title', \Magento\Framework\Db\Ddl\Table::TYPE_TEXT, 255, [
                'nullable'  => false,
            ], 'Comment Title')
        ->addColumn('comment', \Magento\Framework\Db\Ddl\Table::TYPE_TEXT, '64k', [
                'nullable'  => false,
            ], 'Comment')
        ->addColumn('status', \Magento\Framework\Db\Ddl\Table::TYPE_SMALLINT, null, [
                'nullable'  => false,
            ], 'Comment status')
        ->addColumn('customer_id', \Magento\Framework\Db\Ddl\Table::TYPE_INTEGER, null, [
                'identity' => true,
                'unsigned' => true,
                'nullable' => false,
                'primary' => true
            ], 'Customer id')
        ->addColumn('name', \Magento\Framework\Db\Ddl\Table::TYPE_TEXT, 255, [
                'nullable'  => false,
            ], 'Customer name')
        ->addColumn('email', \Magento\Framework\Db\Ddl\Table::TYPE_TEXT, 255, [
                'nullable'  => false,
            ], 'Customer email')
        ->addColumn('updated_at', \Magento\Framework\Db\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Blog Comment Modification Time')
        ->addColumn('created_at', \Magento\Framework\Db\Ddl\Table::TYPE_TIMESTAMP, null, [], 'Blog Comment Creation Time')
        ->addForeignKey(
            $installer->getFkName(
                'vendor_blog_blog_comment',
                'blog_id',
                'vendor_blog_blog',
                'entity_id'
            ),
            'blog_id', $installer->getTable('vendor_blog_blog'), 'entity_id',
            \Magento\Framework\Db\Ddl\Table::ACTION_CASCADE, \Magento\Framework\Db\Ddl\Table::ACTION_CASCADE)
        ->addForeignKey(
            $installer->getFkName(
                'vendor_blog_blog_comment',
                'customer_id',
                'customer_entity',
                'entity_id'
            ),
            'customer_id', $installer->getTable('customer_entity'), 'entity_id',
            \Magento\Framework\Db\Ddl\Table::ACTION_SET_NULL, \Magento\Framework\Db\Ddl\Table::ACTION_CASCADE);

I just need a way to sort out. If I am wrong somewhere please figure it out.


texts: how to refresh the page when a product is added

texts:
How do i refresh a page when someone clicks the add to cart button my current add to cart code is

<?php $_product = $this->getProduct(); ?>

<?php $buttonTitle = $this->__('Add to Cart');  ?>

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

        <?php if(!$_product->isGrouped()): ?>
<?php echo $this->__('Quantity') ?>:

        <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />

        <?php endif; ?>

        <button type="button" title="<?php echo $buttonTitle ?>" <location.reload();> <class="button btn-cart" onclick="productAddToCartForm.submit(this)" > <?php echo $buttonTitle ?></button>

        <?php echo $this->getChildHtml('', true, true) ?>

<?php endif; ?>


texts: Magento 2 custom theme layout xml and css not working

texts:
I created a new theme and it was working fine but after a few days, I realized some things weren't working.

default_head_blocks.xml is no longer pulling in any css files that I include (both hosted and external)

default.xml  is not overwriting parent one.

I'm not sure what is causing this. I even tried deleting /var/ folder as well as /pub/static/frontend/


texts: Hardcoded OG (Opengraph) tags on CMS homepage Magento 2

texts:
On magento 1 I had a code snippet that would tell if the currently loaded page was a cms page, or a particular page and I could use that code to implement the OG tags for the homepage.

Facebook doesn’t make a good job of extracting any info from our current homepage, and while all categories and products work properly, the homepage returns nothing when posted to Facebook.

Does anyone know if a similar code to what I explained for mage 1 is available for mage 2 or if there is a template file that is cms page exclusive somewhere where I could hard code the OG tags into?


texts: How to send email in Magento 2 programmatically without creating custom module?

texts:
I need to create a custom script which allows me to send a simple test email with email addresses of Sender, Receiver CC Bcc; Subject line and Body of Email. How could I do this in Magento 2.x?

----- Update -----

I tried to send email by creating a function in my custom script but it didn't work:

Here is my function which I created in my custom script.

function sendEmail(){
    use Magento\Framework\App\Bootstrap;
    require __DIR__ . '/app/bootstrap.php';

    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    $transport = $objectManager->create('Magento\Framework\Mail\Template\TransportBuilder');
    $templateVars = [
                        'message'    => "This is a test email."
                    ];
    $templateId =1;
    $storeId =1;

    $data = $transport
                    ->setTemplateIdentifier($templateId)
                    ->setTemplateOptions(['area' => Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId])
                    ->setTemplateVars($templateVars)
                    ->setFrom([
                                'name' => 'Test',
                                'email' => 'test@gmail.com'
                                ])
                    ->addTo(['test@gmail.com','test@gmail.com'])
                    ->setReplyTo('test@gmail.com')
                    ->addBcc('test@gmail.com')
                    ->getTransport();
    $data->sendMessage();
}

ERROR:

  Fatal error: Uncaught UnexpectedValueException: Email template '1' is not defined. in /var/www/html/magento232sd/vendor/magento/module-email/Model/Template/Config.php:225 Stack trace: #0 /var/www/html/magento232sd/vendor/magento/module-email/Model/Template/Config.php(166): Magento\Email\Model\Template\Config->_getInfo(1, 'type') #1 /var/www/html/magento232sd/vendor/magento/module-email/Model/Template.php(215): Magento\Email\Model\Template\Config->getTemplateType(1) #2 /var/www/html/magento232sd/vendor/magento/module-email/Model/AbstractTemplate.php(709): Magento\Email\Model\Template->getType() #3 /var/www/html/magento232sd/vendor/magento/module-email/Model/AbstractTemplate.php(331): Magento\Email\Model\AbstractTemplate->isPlain() #4 /var/www/html/magento232sd/vendor/magento/module-email/Model/Template.php(379): Magento\Email\Model\AbstractTemplate->getProcessedTemplate(Array) #5 /var/www/html/magento232sd/vendor/magent in /var/www/html/magento232sd/vendor/magento/module-email/Model/Template/Config.php on line 225


texts: Magento2: Time and Date of last Cache Flush

texts: Is there any place that I could see the last time the cache was flushed?


texts:
I am installing magento 2.1.6 on ubuntu 16.04, when i install it via command line, it shows me the following information:
Missing following extensions: 'gd' 'mcrypt' 'intl' 'mbstring' 'zip'

What's happened and what should i do?

Other info:
mysql 5.7 installed
PHP 7.0.15 installed
Apache 2.4 installed

Zip is actually installed already.

Thank you


texts: New Theme A/B Testing with Google Analytics

texts:
I would like to know what is the best way the run a/b testing with Google analytics between two different themes.

Google analytics a/b testing tool requires too different url's .
Which means that the solution must be based on

domain/ -> this is old current theme url.
domain/new/ OR domain/?new=true -> this is new theme Google requests to put a JS code within page A which makes a redirects half traffic to page B.
Thanks


texts: How to Load JS Code at the Top Using RequireJS

texts:
How can I load a custom JavaScript file using RequireJS at the very beginning? Please note: The key is that RequireJS must load my script FIRST, before any other scripts, as the rest of my script depends on that file.

Currently, my:

  requirejs-config.js

Has the following code:

var config = {
    deps: [
        'js/myJS',
    ]
};

My file, located in app/design/frontend/Vendor/Theme/web/myJS.js, is working, but it's being loaded AFTER the rest of the RequireJS files. How can I load myJS.js to be the very first file RequireJS loads?


texts:
I am using Magento 1.9.0.1 with Metroshop theme (from Themeforest).

I hope someone can help me or give any advice what I should to check.

In CMS/Static blocks I added new one (like in manual):

in example:

name: bottom4_promotional_static_block
id: bottom4_promotional_static_block
status: enabled

Then I pasted code (like in manual):
"

"

But I do not see any change. I flush magento cache. No change.

Also I tried to add:

System/Permission/Blocks: CMS/Block

Still nothing happened.

I do not know what I should to check right now, why blocks are not visible...

Please help..

code from app\design\frontend\default\metrostore\template\catalog\product\home.phtml

    <?php elseif($config['home-page-option']==2):?>

<?php echo $this->getLayout()->createBlock('mlayer/mlayer')->setTemplate('mlayer/mlayer.phtml')->toHtml(); ?>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('bottom4_promotional_static_block')->toHtml() ?>

<?php elseif($config['home-page-option']==3):?>

<?php echo $this->getLayout()->createBlock('mlayer/mlayer')->setTemplate('mlayer/mlayer.phtml')->toHtml(); ?>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('bottom3_promotional_static_block')->toHtml() ?>

<?php elseif($config['home-page-option']==4):?>

<?php echo $this->getLayout()->createBlock('mlayer/mlayer')->setTemplate('mlayer/mlayer.phtml')->toHtml(); ?>

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('bottom2_promotional_static_block')->toHtml() ?>

<?php elseif($config['home-page-option']==5):?>

    <?php echo $this->getLayout()->createBlock('mlayer/mlayer')->setTemplate('mlayer/mlayer.phtml')->toHtml(); ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('right3_promotional_static_block')->toHtml() ?>

<?php endif; ?>


texts:
I was trying to change my backend URL.
So i changed it in  Stores -> Configuration -> Base URL  To the actual site URL.

Now i am no longer able to access the backend anymore.

All i get is

Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
If you typed the URL directly, please make sure the spelling is correct.
If you clicked on a link to get here, the link is outdated.

Is there any way to fix this?


texts: Magento 2 How can I stop Google to index my product image and details?

texts:
I have b2b and b2c websites in my magento2 project.

Is there a want to stop Google to index my product images and details in b2b website, I don't need SEO on b2b.

How can I achieve this?


texts:
I am getting this error:

web-token/jwt-framework[v2.2.7, ..., v2.2.10] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.

Root composer.json requires web-token/jwt-framework ^v2.2.7 -> satisfiable by web-token/jwt-framework[v2.2.7, v2.2.8, v2.2.9, v2.2.10].


texts: Magento 2 Indexer Allowed memory size of xxxx bytes exhousted

texts:
When running the Magento 2 indexer process from the CLI with command:

./magento indexer:reindex customer_grid

I get the following error:

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 280224918230723 bytes) in /www/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228

The number of bites it tries to allocate is unrealistic. so increasing the memory limit is no option ( Also I think 1GB is already way too much.

I tried manually setting the index to invalid via the database and retrying to index. but this does not change anything. I also can’t find a matching table in the DB to flus as this did solve the problem in Magento 1.x.

The server runs on PHP version 7.0.0 and MariaDB version 10.1.9


texts:
How to write the equivalent layout xml file in magento 2

<layout version="0.1.0">
  <merchandisingpage_index_index translate="label">
    <reference name="head">
      <action method="setTitle">
         <title>Merchandising</title>
      </action>
    </reference>

 <reference name="root">
  <action method="setTemplate">
      <template>page/3columns.phtml</template>
  </action>
</reference>

<reference name="left">
  <block type="merchandisingpage/filter" name="custom_filter" before="-"/>
</reference>

<reference name="content">
  <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

   <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="tagalys_toolbar/toolbar.phtml">

    <block type="page/html_pager" name="product_list_toolbar_pager"/>
    </block>

    <action method="setToolbarBlockName">
      <name>product_list_toolbar</name>
    </action>

  </block>
</reference>
</merchandisingpage_index_index>


texts: I am trying to solve a problem that I have with elasticsearch and magento 2.3, and I have been recommended to add a new node but I do not know how to launch the query from the terminal, can someone help me? I have elasticsearc on the same server where I have Magento (ubuntu + nginx)


texts: Onepage checkout: how to start checkout from shipping method?

texts:
I have several shipping methods. And each method has own rates.
But I cannot get it while the user enters his address.

I would like to get all active shipping methods and their rates.
After user selected shipping methods he should select payment method (depends on shipping method) and fill his address fields (fields also depends on shipping method).

To get all shipping methods is simply enough:

$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();

But to get its rates without address - a little bit complex.

Any ideas on how to solve it?

Perhaps someone could recommend some modules.


texts:
I want to define a specific value for adjustment fee, for instance "10".
So each refund will be decremented of this value.
For example:
A customer create an order (100), then create a return. If the return is valided, I want to refund 90 (100 - 10).
I know I can manually do this action from the BO, but I want to do this automatically.
But I don't find in the code where to put something like :
$creditmemo->setAdjustmentNegative(10);

Is there a configuration for that? Or if I need to code, where can i put this code? Are there other solutions?
FYI I use MCOM as OMS, so my refund are create by API message from OMS. I don't create refund manually from the BO of Magento.


texts: Magento Mobile SDK For Android and Iphone

texts: Recently Magento launched Mobile SDK for android and ios. This SDKS are only for enterprise edition. I would like to know if there any planning of launching mobile SDK for community edition?. Thanks in advance


texts: Magento 1.9.3.8 removing redundant tables

texts:
Over the last few days I have been carefully analysing my database and noticed some tables, which I believe are from previous versions. Searching my 1.9.3.8 code base to analyse the scripts, I cannot see them being removed anywhere. Thus, how can I remove them?

These tables are:

commentbox_comment
cms_widget
catalogindex_price
catalogindex_minimal_price
catalogindex_eav
catalogindex_aggregation_to_tag
catalogindex_aggregation_tag
catalogindex_aggregation
find_feed_import_codes
googlebase_attributes
googlebase_items
googlebase_types
googlecheckout_api_debug
googlecheckout_notification
googleoptimizer_code
shipping_matrixrate
xmlconnect_application
xmlconnect_config_data
xmlconnect_notification_template
xmlconnect_queue

I have also noticed catalog_product_index_eav and catalog_eav are emptpy shouldn't these tables be full or is it also an obsolete table?


texts: Create an auto reference number for every magento order id (for courier billing purposes )

texts: I want to create a reference number for every Magento order that comes, which I want to use for courier billing purposes. A reference number will be additional security for me for courier billing purposes. I want to use both order number and reference on shipping slip.


texts: Magereport test unknown after adding RewriteRule

texts:
My store was showing all the installed patches on Magereport until I added RewriteCond %{REMOTE_ADDR} !^xx.xxx.xx.xxx
RewriteRule ^(index.php/)?admin/ - [L,R=403]
RewriteCond %{REMOTE_ADDR} !^xx.xxx.xx.xxx
RewriteRule ^(index.php/)?rss/ - [L,R=403] to the .htaccess. I scan the store and everything is in grey(unknown)
I have reverted the changes in the .htaccess file (Deleted the rewrite command) but its still the same.
Any help please


texts: Magento 1: Problems translating "This is a required field."

texts:
For my configurable products I'm trying to translate the sentence "This is a required field.". But I cant seem to translate it for some reason.

I've tried editting the following files:

prototype/validation.js,

local/language files,

\app\code\core\Mage\Core\Helper\Js.php

I've also tried adding translations with jQuery with the following code:

selector.attr('This is a required field.', Translator.translate('Dit veld is verplicht.'))

Code for calling the product options

  <div class="custom-options">
    <?php if (!$sname) :?>
      <?php if ($_item->isSuper() || $_item->getHasOptions()) : ?>
        <?php echo $this->getChild('groupedoptions')->setProduct($_item)->toHtml(); ?>
      <?php endif; ?>
    <?php else: ?>
      <?php if ($_item->isSuper() || $_item->getHasOptions()) : ?>
        <?php echo $this->getChild('groupedoptions')->setProduct($_item)->toHtml(); ?>
      <?php endif; ?>
    <?php endif;//micosolutions ?>
  </div>

I've tried replacing

echo $this->getChild('groupedoptions')

with

echo $this->getChild__('groupedoptions')


texts: Magento 2export customer grid in excel format

texts: How to export customer grid in excel format magento 2.


texts: Magento 2 website redirecting constantly

texts:
I installed my new Magento2 page on the domain yesterday but I keep get an error that I cannot manage to solve. Where am I making a mistake.

  The page isn’t redirecting properly Firefox has detected that the
  server is redirecting the request for this address in a way that will
  never complete. This problem can sometimes be caused by disabling or
  refusing to accept cookies.

I cannot figure out what is going wrong where

domain:
www.thefixedgearshop.com

When changing the web/url/redirect_to_base to 0 in phpmyadmin I get the website back and can browse around but my backend is not reachable. Also the font-awesome icons are not displayed.


texts: Page not refreshing Cli commands not working

texts:
Flush magento or clean magento CLI commands not working
page not refreshing or not refresh data and pages.
Any idea ???? please help


texts: Dynamically accepted the Reviews and Rating

texts: I want to approve the reviews or rating without admin manual approval.Means i don't want that admin approve all the pending rating but as rating comes it got approved.I have searched the admin panel for this option and on Google but no luck.As there any default method or i have to code for that ?


texts: Magento 2 : How to make "lastname " optional in customer registration form?

texts: I need to make lastname optional in customer registration form.


texts: 'Internal Server Error' in Magento multistore (subdomain)

texts:
I'm running Magento CE 1.8. I've set up multiple stores (website, store, and store view) in Magento successfully using parked domains. Yesterday, I set up two additional stores using subdomains. Here's what I followed...
https://www.siteground.com/tutorials/magento/magento-multistore.htm
The only thing I did differently was adding the code to index.php. Adding the code this article indicates causes an error, since the index.php already has the following code:

  /* Store or website code */
  $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ' ';

  /* Run store or run website */ $mageRunType =
  isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] :
  'store';

So, I just filled it in with the right info.

The homepage of each new store works fine. But that's it. If I try to navigate to my cart, a product page, or CMS page, I get an internal server error, with a notice that a 500 error occured when trying to use an error handler. It's not putting out error logs on the server, so it's hard to know what's not working. The root install of Magento, as well as the additional stores I had already set up using parked domains still funtion fine on all pages, including the admin.

I've checked memory limits in my .htaccess file, and it's set to 256m. I think that's good enough; I don't have a whole lot of SKUs running in any of my stores.

Any help is greatly appreciated - I have to get these stores up ASAP.


texts: PDO loads fine in Magento but not in external CMS

texts:
I am having a problem similar to https://stackoverflow.com/questions/2386575/the-pdo-extension-is-required-for-this-adapter-but-the-extension-is-not-loaded but not the same.

The Magento install is running fine but when I try to run:

require_once(APATH.MAGEPATH.'/app/Mage.php');
umask(0);
Mage::app();

in a directory outside of Magento I get the error:

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The PDO extension is required for this adapter but the extension is not loaded' in
/home/inzana/public_html/Store/lib/Zend/Db/Adapter/Pdo/Abstract.php:342
Stack trace: #0 /home/inzana/public_html/Store/lib/Zend/Db/Adapter/Abstract.php(247): Zend_Db_Adapter_Pdo_Abstract->setFetchMode(2)
#1 /home/inzana/public_html/Store/app/code/core/Mage/Core/Model/Resource.php(165): Zend_Db_Adapter_Abstract->__construct(Array)
#2 /home/inzana/public_html/Store/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#3 /home/inzana/public_html/Store/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#4 /home/inzana/public_html/Store/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#5 /home/inzana/public_html/Store/app/code/core/Mage/Core/Model/R in /home/inzana/public_html/Store/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 342

I am running phpinfo(INFO_GENERAL); followed by the code that causes the error on this page: http://inzanaranch.com/test

The local php.ini file includes:

extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

I am a loss of where to go next.  Any help appreciated.


texts: I'm using 1.9 . I have separate root categories for men and women. Each have subcategories of hats and shirts. I also have root categories of hats and shirts that were recently added. They were input after all the products were already associated with the correct sub category under men and women. Is there any easy way to map the already setup categories to the new ones in magento or run a sql statement to accomplish this ? Ideally I would like to the hats and shirts root categories to contain all products with that category without gender classification.


texts:
How to change www.domain.com/ecommerce base URL to www.domain.com

In my cpanel folder structure is like public_html/ecommerce .

When I am updating www.domain.com in baseurl and removing ecommerce from base url site  is not working even after clearing cache and session from backend and not able to login to the site.

Can any one please help me on this I am new to magento?


texts:
I am wanting to try and find out how to set up configurable products to where the color swatches are linked to simple products but beyond that how we can have the HREF be updated as well as the description and product name in the address bar when each swatch is clicked on. See example below of what we're attempting to emulate:

https://www.braun-hamburg.com/en/von-braun-cashmere-knit-blazer-light-grey.html#

Example:

If 'blue' is selected 'Blue' is then dynamically added to product title, is referenced in URL and the description notes content as it relates to that 'blue' product.


texts: Magento 2 Get Cart Quote Total in minicart.phtml

texts:
I'm trying to get the cart quote total in minicart.phtml, but I'm having no luck.  I'm injecting Magento\Checkout\Model\Cart.

Here's my code:

$this->cart = $cart;
$cartQuote= $this->cart->getQuote()->getData();
echo $cartQuote['base_grand_total'];

After I run that code the minicart breaks and disappears totally from the frontend.

Thanks!


texts: magento 2 graphQL not loading mutation in custom module graphql doc

texts:
I created a custom module for mutation

with table

when I create mutation is not loading in graphql doc

Type \"PracticeOutput\" not found in document.\n\nException #0 (GraphQL\\Error\\Error)

schema.graphql

type Query {
    Practice: outputdata @resolver(class: "GraphQL\\Practice\\Model\\Resolver\\Output") @doc(description: "The pratice query returns information ")
    Practicid(id:Int! @doc(description: "Get data based on id")):
    outputdata @resolver(class: "GraphQL\\Practice\\Model\\Resolver\\Idoutput") @doc(description: "The pratice query returns information ")
}
type Mutation {
    Createpracticedata (input:practiceinput!): PracticeOutput @resolver(class: "GraphQL\\Practice\\Model\\Resolver\\Create") @doc(description: "The pratice query Create ")
}

type outputdata @doc(description: "Return all data  in the table") {
    id: Int
    name: String
    email: String
    description : String
    publish_date: String

}
type PracticeOutput{
    outputdata:outputdata!
}
input practiceinput{
    name:String @doc(description: "The customer's first name")
    email: String @doc(description: "The customer's email address")
    description:String @doc(description:"The description about data")
}

but query is loading in graphql doc

  Only parameter query is accepting not accepting Input - type


texts: How to find out the block or xml responsible for code $block->getChildHtml('customer.form.register.newsletter')?

texts:
I have a question about the below snippet. How to find out which file(.xml, .phtml) is responsible for the output. I have searched using Phpstorm in my Magento 2 directory thinking it's block name. It's just returning only one occurrence in entire project,  the file where I got this code (vendor/magento/module-customer/view/frontend/templates/form/register.phtml )
$block->getChildHtml('customer.form.register.newsletter')

What is the logic behind it? How do I move forward if I encounter this again?


texts: how to show stock quantity on module-catalog-widget (luma theme, grid.phtml)

texts:
I try to show product quantity on module-catalog-widget (grid.phtml) by using the below code (Magento 2.3)

<?php

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');
$qty = $StockState->getStockQty($_product->getId());
echo  $StockState->getStockQty($_product->getId());

?>

It showed that We're sorry, an error has occurred while generating this content.

Please anyone help me, which code should be used on product widget front page luma magento2?

Thank you in advance.


texts: how do I set folder permissions on windows Magento 2.2 install?

texts:
I'm using laragon in a windows 10 machine for a 2.2.3 Magento install. What folder permissions do I have to set?

By default, all folders are read-only (or so it seems). Currently, I set writable folders (and files):
/var/
/pub/media
/pub/static


texts:
I can get from collection "sales/order" customer ids, but when customer is unregistered, value is "null". What can I do to show in grid which customer is registered, with filter "true" or "false". My code:

    protected function _prepareCollection()
    {
        $collection = Mage::getModel('sales/order')->getCollection()
                        ->addAttributeToSelect('customer_id');
                foreach($collection as $coll)
                {
                    if ($coll['customer_id'] != '')
                    {
                        $coll['customer_id'] = 'yes';
                    }else{
                        $coll['customer_id'] = 'no';
                    }
                }
    ...

    protected function _prepareColumns()
    {
        $this->addColumn("customer_id", array(
                "header" => Mage::helper("mymodule")->__("Registered"),
                'type' => 'options',
                'options' => array(
                        'yes' => 'True',
                        'no' => 'False'
                    ),
                "index" => "customer_id",
            ));
     ...

This option was destroy grid filter. Is any better solution?


texts: How to disable custom observer for particular page in magento2

texts: I want disable my created custom observer for my created custom listing page in magento2.


texts:
many customers have following problem:

They put products in the cart
They login
The cart ist empty

I am not able to reproduce that issue and I have also tried different browsers. The customers have also cleaned cookies and website settings and so on.
I hope that is any common known issue.
Magento Version: 2.3.2-p2


texts: URL paths not reflecting url key from admin panel

texts:
I am trying to work out why some of my URLs are being presented like the below

/catalog/product/view/id/75/s/whiskware-egg-mixer/category/15/

I have run bin/magento indexer:reindex but the URLs aren't matching the keys which have been set via the adminpanel

The URL key in admin panel is whiskware-egg-mixer and when I browse to this path I am presented with a 404 error


texts: Magento2.2.2: Module override cause in Wysywig editor shows broken image

texts:
I have to override the Customer module.

vendor/magento/module-customer/Model/Indexer/Source.php

in my custom module

app/code/Magenticians/Moduleproduct/Model/Indexer/Source.php

here is registration.php file :

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

in etc folder di.xml and module.xml file

...di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Customer\Model\Indexer\Source" type="Magenticians\Moduleproduct\Model\Indexer\Source" />
</config>

module.xml:

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

just add one function in source.php file

public function addAttributeToSelect($fieldName, $alias = null)
{
   $this->customerCollection->addAttributeToSelect($fieldName, $alias);
   return $this;}

override successfully. customer re-indexing has done.

but got an issue in Wysywig editor shows a broken image. which I insert in pages.

when I remove this overridden module Wysywig editor shows images properly.
I want to identify what's wrong with my module and why Wyswig show a broken image when this module is here?


texts:
I created a custom block and was able to link to it on the home page or display it there. Unfortunately I don't get the block displayed on another page I created via the backend.
If I understand the whole thing correctly, do I have to change the name of the .xml created in the layout?
This is how it works:

and that's how it doesn't work:

Do you have any idea how I can get the second case working?


texts:
How to fix parse error in site.com/customer/section/load/
There is an extra 'SS'.


texts:
I have followed the docs for setting up Less compilation. Running grunt clean and grunt less works without errors, but when I run grunt exec (with or without appending a specific theme name) I get the following error:

Execution Time (2018-03-09 15:33:35 UTC)
loading tasks                55ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 58%
loading grunt-contrib-clean   3ms  ▇▇ 3%
clean:mytheme           37ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇ 39%
Total 95ms

>> Exited with code: 255.
>> Error executing child process: Error: Process exited with code 255.
Warning: Task "exec:mytheme" failed. Use --force to continue.

I've tried so many different things to get this working but to no avail. Has anyone encountered this before?

My dev/tools/grunt/configs/themes.js has this added:

mytheme: {
    area: 'frontend',
    name: 'Mycompany/mytheme',
    locale: 'en_US',
    files: [
        'css/styles-m',
        'css/styles-l'
    ],
    dsl: 'less'
}

And my Gruntfile.js and package.json files are the same as those included with v2.2.2 (the sample files renamed).


texts: Magento 2: change the "Contact Us" page layout

texts:
I am working on a Magento 2.1.7 shop and  I have created a child-theme of Magento Blank.

I've changed the layout of my homepage to 2 columns with left bar from Content -> Pages. I need to do the same for the Contact Us page.

As can be seen in the image below, I don't have this option for the  Contact Us page:

What (XML) file must I edit to achieve this?


texts: GetLocalizedLabel not working under Grouped Products

texts:
I'm trying to extract 3 attributes for every associated product under a grouped product page.

I use a multistore Italian-English but if I use

 $stato_label= $_item->getResource()->getAttribute('stato')->getFrontend()->getLocalizedLabel($_item);
 $stato_value= $_item->getResource()->getAttribute('stato')->getFrontend()->getValue($_item);

Just the attributes value has been translated.
The label is still is not using the translation

I have already translated the labels on the backend

How can I get the translated image?

Thanks for help


texts: Magento 2 error 500 after adding a module

texts:
I added a module by these command

php bin/magento module:status
php bin/magento module:enable module

Everything was fine then I run this

php bin/magento setup:upgrade

After this everything messed up,
The output of this command is

php bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
/home/xyz/public_html/var/generation/Composer
/home/xyz/public_html/var/generation/Magento
/home/xyz/public_html/var/generation/Symfony
The directory '/home/xyz/public_html/var/di/' doesn't exist - skipping cleanup
Updating modules:
Schema creation/updates:

And after the execution of this command My site returning HTTP ERROR 500.

Any Idea how to solve this ??


texts: Magento 2.2 Fatal error: Uncaught ReflectionException: error

texts:
i created a new module, after runing this command

  php bin/magento module:enable myFirstModule

i am getting this error.

  Fatal error: Uncaught ReflectionException: Class Magento\Framework\App\ResourceConnection\Proxy does not exist in C:\xampp\htdocs\magento2\vendor\magento\framework\Code\Reader\ClassReader.php:19 Stack trace: #0 C:\xampp\htdocs\magento2\vendor\magento\framework\Code\Reader\ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...') #1 C:\xampp\htdocs\magento2\vendor\magento\framework\ObjectManager\Definition\Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...') #2 C:\xampp\htdocs\magento2\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...') #3 C:\xampp\htdocs\magento2\vendor\magento\framework\ObjectManager\ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #4 C:\xampp\htdocs\magento2\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManage in C:\xampp\htdocs\magento2\vendor\magento\framework\Code\Reader\ClassReader.php on line 19

i have clear all of my cache and also used upgrade command.
but in CMD the results are...

what would be the reason of this?
i also removed those module files but still there is error.


texts: Magento 2 + need to use fotorama in cms page

texts:
Is there any way to use fotorama slider in CMS pages?

Slider:


texts: Inconsistent translations populated in the js-translation.json

texts:
Can anyone please shed some light on the js-translation.json and where it pulls the phrases in from?

We have a Spanish store view and we have 934 phrases translated in our app/i18n/vendor/es_es/es_ES.csv language package.

We also have custom modules, some of which include translations in their app/code/Vendor/ModuleName/i18n/es_ES.csv

After setup:static-content:deploy es_ES (and all caches cleared etc etc) the js-translation.json file generates and IS populated but it only contains 194 phrases, some of which are specifically from custom modules, some of which are from the main language package.

If a phrase is included in the js-translation.json which has come from a custom module I would expect all phrases from that custom module would be included, but this is not the case.

I would also expect that if the js-translation.json contains phrases from the main language package then it would contain them all, which is not the case.

I can confirm that ALL translations are actually working on the frontend but my question is why are only some translations included in the js-translation.json and not all?

Thanks in advance for any light you can shed on this!


texts: Magento2 - Form validate instant and add class

texts:
Is there a way to directly validate a form in Magento2.3x?

So that when the input focus goes to the next input element, it automatically validates the previous input and add a class to the input?

We want to show some approve or decline icon when a user fills the form in correct.
This so the customer knows the input is or is not correct.

It's quite easy JS on Magento1.9x, but I can not find it for Magento2.3.


texts: How to upload multiple pdf file to Manufacturer in magento 1.9.1.1

texts: How to upload multiple pdf file with manufacturers in magento 1.9.1.1, I have use this plugin for upload manufacturer logo but I want to upload multiple pdf also


texts: How to rewrite magento catalog/search url?

texts:
Need to rewrite magento catalog search url catalogsearch/result?q=query so that it should be like katalog/resultater?q=query. As you can see before and after slash it should be different according to initial url.

Simply I need to translate this url. How to do this?


texts: addInStockFilterToCollection() is not correctly filtering configurable products which are out of stock

texts:
Magento Enterprise 1.14.2.

Notice: This question is directly related to my other question: Why does $product->getData["is_in_stock"] differ from $product->getStockItem()->getIsInStock()?

I'm trying to get a collection of all products on my site which are actually in stock:

$inStockProducts = Mage::getModel("catalog/product")
                   ->getCollection()
                   ->addAttributeToFilter("status", 1)
                   ->addAttributeToSelect("id");

Mage::getSingleton('cataloginventory/stock')
      ->addInStockFilterToCollection($inStockProducts);

However, the above collection still includes configurable products whose children are all out of stock, and whose stockItem stock status is 0 (i.e. out of stock).

It seems like this method is filtering on some kind of inaccurate indexed stock status and not the actual stock item stock status.

For example, I might get the following output from the above code:

foreach ($inStockProducts as $inStockProduct) {

    // This might output "0" even though I used the above "InStockFilter"!
    echo $inStockProduct->getStockItem()->getIsInStock();

    // And for the same product this might output "1"!
    echo $inStockProduct->getData["is_in_stock"];

}

Reindexing the stock status index (or all indexes) does not have an effect.


texts: Reindexing cron not executing at specified time

texts:
I am trying to execute cron job of reindexing at specified CST time but not working, so anyone let me know what to do?

Thanks
Ketan


texts: Display default price when tierprice is not available magento 1.9

texts:
I have a customer, who has a tier price for almost every product in their webshop. But some products don't have a tier price.
In template/catalog/product/list.phtml the tier price is added through this:

<?php echo $this->gettierPriceHtml($_product, true) ?>

Which displays template/catalog/product/view/tierprices.phtml

But how to show the default price when there is no tierprice for this product?


texts:
Currently I have home page www.example.com. But now, I want to set landing page before the home page and the url of the landing page will become www.example.com and the url of the home page will become www.example.com/home. So, the basic structure will be.

Current structure

URL to the home page: www.example.com

The structure I would like to change

URL to the landing page: www.example.com
URL to the home page when the block/image on the landing page is clicked: www.example.com/home


texts: How can i solve the error oftenly my menu script collapsed.

texts: Am using magento sample data theme and changed menu block. How can i solve oftenly my menu script collapse. i am using this menu.


texts: Magento vs mass change attributes/inventory/etc

texts:
Trying to update some things in products so what I've done is:

$attribute_code = use_config_manage_stock;
$attributeValue = 1;

$data = $attributeCode.' = '.$attributeValue;
Mage::log($data, NULL,'changes.log');
$attrData = array( $attributeCode => $attributeValue );
$storeId = 0;
//getting allIds from catalog/products
$allProductIds = Mage::getModel('catalog/product')->getCollection()->getAllIds();
//connection - just in case ...
Mage::getSingleton('core/resource')->getConnection('core_write');
//but next line is causing error 500.
Mage::getSingleton('catalog/resource_product_action')-> updateAttributes($allProductIds, $attrData, $storeId)){
Mage::getModel('catalog/product_action')->updateAttributes($allProductIds, $attrData, $storeId);

What I've done wrong?
I can loop through and update all the products one by one but if I can do it using this "->updateAttributes" ... what is the problem?


texts: Add custom option into shipping details of customer at checkout

texts:
I am looking for tutorial for adding some new custom detail into shipping details. And then how to save that detail into database. I am working on magento framework and using php language. I  know magento handles the work of saving shipping details by itself. But i my not able to understand how it do this.
Help me for this case i really need to solve this asap and i am clueless.


texts: Magento 2 - How to use mysql find_in_set?

texts:
In Magento 2, I try to use find_in_set mysql function but without success.

I try this :

$result->getSelect()->order("find_in_set(e.entity_id,'".implode(',',$sort_order)."')");

But it give me an error :

Column not found: 1054 Unknown column 'find_in_set(e.entity_id,'730,740,753,....

I also try this but it doesn't work :

$result->addFieldToFilter('e.entity_id',array("finset"=>$sort_order));

Do you have an idea about the problem ? And how to make it work ?

Thanks

EDIT

I find a solution, with Zend_Db_Expr, this line work for considering "find_in_set(..." as a function and not a column name :

$result->getSelect()->order(new \Zend_Db_Expr("find_in_set(e.entity_id,'".implode(',',$sort_order)."')"));


texts: Different category URLs for store views, redirect to proper one

texts:
I would like to have different URL keys for a category for every store view.
ex http://store.com/electronics.html for EN store

http://store.com/electronics-gr.html for a GR view.

When i switch store views when inside the category it properly redirects me to the correct one. If however i have my website on the GR store view and i click a link outside of my shop http://store.com/electronics.html that will throw a 404 not found.

Only solution i could come up with was each time a category is saved to create a 301 Redirect for say /electronics.html to /electronics-gr.html for the GR store view and so on.

Before going on through i would like some feedback, if there is some other solution i could go with?