texts: Create catalog price rule for custom options

texts:
Is it possible to create/apply catalog price rule for product custom options? So that i can have a discount for particular custom option choosed by customer.

Any help will be appreciated!!!


texts: Remove Empty option from Gender drodopwn and make female default option

texts:
I have added dropdown to choose Gender on Register-page.
There are only two options ie Male and Female in Backend.
On Frontend, In Gender dropdown, first value display as Blank then Male and then Female.

I want to Remove that blank option and female Option as default.
If user not select any option from dropdown then it should be considered as Female.

<label for="<?php echo $this->getFieldId('gender')?>" class="gender-
  label <?php if ($this->isRequired()) echo ' class="required"' ?>"><?
  php if ($this->isRequired()) echo '*' ?><?php echo $this-
  >__('Gender') ?>

      <select id="<?php echo $this->getFieldId('gender')?>" name="<?php
        echo $this->getFieldName('gender')?>" title="<?php echo
        Mage::helper('core')->quoteEscape($this->__('Gender')) ?>"<?php if
        ($this->isRequired()):?> class="validate-select"<?php endif; ?> <?
        php echo $this->getFieldParams() ?>>
         <?php $options = Mage::getResourceSingleton('customer/customer')-
           >getAttribute('gender')->getSource()->getAllOptions();?>
              <?php $value = $this->getGender();?>
                 <?php foreach ($options as $option):?>
                     <option value="<?php echo $option['value'] ?>"<?php
                       if ($option['value'] == $value) echo '
                       selected="selected"' ?>><?php echo $option['label']
                    ?></option>
                 <?php endforeach;?>
    </select>


texts: How to select multiple tax-rate In Magento 2?

texts:
I'm using Magento 2 community and created one tax rule.
  Problem is I
  have around 4000 tax rate and if I manually selecting tax rates then
  it takes too much time.
  So anyone has a simple/short solution for this?

  Thanks in advance. Please check attached image for tax-rates selection.


texts: Magento 2 modify CSV file translation not taking place

texts:
I added my translation text into the csv
/app/i18n/vendor/fr_ca/fr_CA.csv

for the Magento Review Module
"Write a review","Écrire une critique",module,Magento_Review

However, I have no idea why it didn't make any changes? I did static content deploy again, flush the cache and it not showing. Am I missing any procedure? Please help


texts: How to get the customer attribute value?

texts:
What I want

add customer attribute
show the new attribute in front(dashboard) page

Problem

I have created customer attribute with this code below:

<?php
define('MAGENTO', realpath(dirname(__FILE__)));

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

Mage::app();

$installer = new Mage_Customer_Model_Entity_Setup('core_setup');

$installer->startSetup();

$vCustomerEntityType = $installer->getEntityTypeId('customer');
$vCustAttributeSetId = $installer->getDefaultAttributeSetId($vCustomerEntityType);
$vCustAttributeGroupId = $installer->getDefaultAttributeGroupId($vCustomerEntityType, $vCustAttributeSetId);

$installer->addAttribute('customer', 'manager', array(
        'label' => 'Account Manager',
        'input' => 'text',
        'type'  => 'varchar',
        'forms' => array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'),
            'visible' => true,
            'global' => true,
            'visible_on_front' => 1,
        'required' => false,
        'default_value' => 'default',
        'user_defined' => true,
));

$installer->addAttributeToGroup($vCustomerEntityType, $vCustAttributeSetId, $vCustAttributeGroupId, 'manager', 0);

$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'manager');
$oAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$oAttribute->save();

echo "DONE";
exit;

And then, this part was normally works. I can find new form in backend and I can update the form with new data. That was good so far but I couldn't get the data in front page section.

When I have searched this problem, the below code seems to normally working but it wasn't work for me.

I put below code in  /app/design/frontend/<Theme>/default/template/customer/account/dashboard.phtml.

$attr = $this->getCustomer()->getAttribute('manager')->getData($customer);
// not working

$customer = Mage::getSingleton('customer/session')->getCustomer();
$attr = $customer->getAttribute('manager')->getData($customer);
// not working

$_customerModel = Mage::getModel('customer/customer');
$_customer = $customerModel->load($this->getCustomer()->getId());
$attr = $_customer->getAttribute('manager')->getData($_customer);
// Yeah, still not working

$attr = $this->getCustomer()->getAttribute('manager')->getData('manager');
// not working but getData('firstname') is working

I think the custom attribute was not fully loaded when the customer loaded. Also it seems to be problem with new version of magento. I couldn't find same problem anywhere.

Can I get the data by force such as connecting to database directly or am I missing something in this code?


texts: Magento Soap API v2 shoppingCartOrder() not working in case of discount amount

texts:
I have used Magento Soap API v2 to create Mobile APP API. For order place I have created a function in which I used API shoppingCartOrder(), this API works perfect when no discount amount added to cart items.

But when I added discount amount on cart Items then discount amount not added to cart totals.

My Custom function code for place order is below :

...
// cart info after apply discount amount
$cartTotal = $soapClient->shoppingCartTotals($sessionId, $cartId);
{ $cartTotal not showing discount amount }

// place the order
$orderId = $soapClient->shoppingCartOrder($sessionId, $cartId, '1', '1');
...

How to add discount amount in cart total in soap API?


texts:
I have installed Magento 1.9.3 with sample data so I have category: Women clothing with url

women.html for the eng view
femmes.html for the fr view
frau.html for the german view

When I switch the language from the language drop down it works fine but the problem is that if I am in english homepage and access mysite.com/femmes.html it gives a 404 instead of redirecting to fr category of femmes.html


texts: Magento 2.3.1 Product Thumbnail Image is not displaying

texts: After upgrading Magento Website from Version 2.0 to Version 2.3.1, product thumbnails are not displaying in "Most Viewed Products". Please help me.


texts: Invalid template file: 'RewardPointsBehavior::scripts.phtml' on login page in magento 2

texts:
I am not able to access the customer login page (Blank white screen while accessing)suddenly, But i can access to sign-up page & other pages too. No errors in console.

But I see this below error in log file:

  main.CRITICAL: Invalid template file:
  'RewardPointsBehavior::scripts.phtml' in module:
  'Lof_RewardPointsBehavior' block's name: 'lrw.fb.scripts' [] []

I'm not sure that this error causing problem or not.

Can anyone please help me to solve this issue?


texts:
I have configurable product create with attribute size, I try to list this attribute size in the product description, but addAttributeToSort() not working. My code is:

if($_product->getTypeId() == "configurable"):
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);

    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addAttributeToSort('size','ASC')->addFilterByRequiredOptions();

right now I have something like this:

100g
10g
25g

If I use DESC instead ASC I have this sorting:

25g
10g
100g

The entire code:

if($_product->getTypeId() == "configurable"):
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);

    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addAttributeToSort('size','ASC')->addFilterByRequiredOptions();
    foreach($simple_collection as $simple_product){
        echo $simple_product->getAttributeText('size');
    }
endif;


texts: Recently viewed products not showing for NOT LOGGED CUSTOMERS in magento 2

texts:
Why recently view products not showing on product view page if any customer not logged.
When customer logged in their account then recently view product showing on product view page.
if customers log out from their account then recently view products not showing on product view page.
Anyone know above problem why above error  generating?
using code below
<?php echo $this->getLayout()
->createBlock("Magento\Reports\Block\Product\Widget\Viewed")
->setDisplayType("recently.view.products")->setProductsCount("4")
->setTemplate("widget/viewed/content/viewed_list.phtml")->toHtml(); ?>


texts: DevBox with magento2 (2.1.6) doesn't reach the proxy in docker container

texts:
I installed the magento2 devbox behind a proxy. My problem is that on the web container the env are not set.

So just to clarify I have in .env a filed http_proxy=ip (that works when I install the whole devbox), then I added extra and - http_proxy=ip in the docker-compose.yml under the environment:.

Now when I ssh into the web container and check it with env I see no http_proxy variable. What should I do to set this variable when the container starts?


texts: Magento 2 - Open cart products by default, in checkout

texts:
The products are hidden by default in the checkout

How can I show them by default?


texts: Category "Match products by rule" not considering store price

texts:
We are using category "Match products by rule" option for assigning products to categories. We have multiple stores with different currencies. When we save a category at the store level having currency, let's say in pounds and put a condition of price less than 50 it assigns the products correctly for that store with products having price less than 50 pounds.
But when we check the same category in different store with different currency, it changes the products with wrong prices assigned.
How to resolve this?


texts: Magento 1.9.1. site is hacked where to start?

texts:
About 2 weeks ago I got an e-mail from a customer of mine if I could help him with his magento site (1.9.1). With my big mouth I said: sure! I can help you.
I have no experience with Magento and I only have build websites in Wordpress, the hostingcompany said that the site was compromised and hacked. I have been trying to cleanup all the bad stuff with a FTP account. However I don't know where to start, please help me.


texts: How can i upload a file using prototype js ajax call

texts:
I have create a varien custom form and want to submit the form using prototype ajax.This form contain four fields

two text field and
two file field.

But when i submit the data using ajax of prototype js the form did not passed  two field and on enctype="multipart/form-data" but does not works.
Code:

<form action="bt" method="post" enctype="multipart/form-data" name="new-art-upload" id="new-art-upload">
<input type="text" name="fname" value=""   class="input-text required-entry"/>
<input type="text" name="fname" value="" class="input-text required-entry"  />
<input type="file" name="fileone"  class="required-entry"   />
<input type="file" name="filetwo" class="required-entry"   />
<button type="submit" title="<?php echo $this->__('Save The Art') ?>"  class="button newAdd_Sub" onclick="newartUpload.submit(this)"><?php echo $this->__('Save Art') ?></button>
</form>

Script:

I guess that it may content type  and mostly content type in form/

Main issue is  that files  input fields are  not sended to ajax request


texts: Magento 2 EE elasticsearch Content-Type header is not supported

texts:
I have successfully integrated elastic search(Elasticsearch 6.0) with Magento Enterprise Edition 2.1. As per their documentation, I have tried to reindex calalog by using magento cli command

bin/magento indexer:reindex catalogsearch_fulltext

But it throws an error like

Catalog Search indexer process unknown error:
Content-Type header [] is not supported

I read that,Elasticsearch 6.0 is implemented strict content-type checking.So how can I solve this in Magento EE 2.1 ?


texts: How to change shipment PDF font style in Magento 2.2.7

texts:
I am working on Magento 2.2.7 &
need to change font style of shipment pdf
i want to achieve that using preference way of di.xml file how to do that.
which files,function i have to override ?


texts: How to add custom option in quote or order item

texts:
We are trying to add custom option or custom value in quote item so that we can also get it in order item.

We are able to add custom value in quote using following code but it is get returning value in order item

  $quote = $this->quoteRepository->getActive($cartId);
    foreach ($quote->getAllItems() as $item) {
            $item->setCustomValue(1);
            $item->save();

     }


texts: Magento 2.2.8 Redirects to Blank Pages from Contact Form and Backend Help

texts:
Yesterday I updated to Magento 2.2.8. Now, I'm having serious issues that I'm not even sure what triggers them.

Firstly, yesterday, I was having issues with the SMTP (Mageplaza SMTP module) - when I try to send test mail, the error

"A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later."

keeps showing. In trying to resolve the outgoing emails issues I went ahead and enabled "Asynchronous sending" from Sales > Sales Emails.

This did not resolve anything. So I went back to disable it only to find out that I'm unable to. When I choose "disable" and click "Save Config" I get a blank page. When I use the browser back button the setting has not changed.

The same blank page issue I have on the Contact form. When I submit the contact form I get redirected to a blank page at

https://example.com/contact/index/post/

And I receive no messages from the contact form.

Please, help me with these issues. I have no idea what causes them. Is the 2.2.8 version broken? Do I need to fix something else? Any suggestions are welcome. :(


texts:
i want to open popup when customer click on a top link

I am adding top link like this

default.xml

<referenceBlock name="top.links">
        <block class="Company\Module\Block\Top\Link" name="blog-link" >
    </referenceBlock>

Link.php

 public function getHref(){
    if($this->customerSession->isLoggedIn()) {
        $page_url = '#';
        return $this->getUrl($page_url);

    }
}

public function getLabel(){
    if($this->customerSession->isLoggedIn()) {
        return "Classes";

    }
}

How to open popup click on top link?


texts: Magento 2 : Which event will trigger when a Navbar Item is clicked?

texts:
I've done some searching around and i'm trying to find the observed event for when a particular navbar item is clicked.

The goal is to run some code for whenever that navbar item is selected but I do not want this piece of code to run on the other navbar items. Is an observer the correct way of achieving this?


texts: Magento 2 - Not able to override CouponManagement Model

texts:
I am trying to override Magento\Quote\Model\CouponManagement core vendor file. What I am trying to achieve is change the default error message when the wrong coupon code is added.

My 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\Quote\Model\CouponManagement" type="Ecs\VendorOverride\Model\CouponManagement" />

</config>

My CouponManagement.php

<?php
/**
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Ecs\VendorOverride\Model;

use \Magento\Quote\Api\CouponManagementInterface;
use \Magento\Framework\Exception\CouldNotDeleteException;
use \Magento\Framework\Exception\CouldNotSaveException;
use \Magento\Framework\Exception\NoSuchEntityException;

/**
* Coupon management object.
*/
class CouponManagement extends \Magento\Quote\Model\CouponManagement
{
/**
 * Quote repository.
 *
 * @var \Magento\Quote\Api\CartRepositoryInterface
 */
protected $quoteRepository;

/**
 * Constructs a coupon read service object.
 *
 * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository Quote repository.
 */
public function __construct(
    \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
) {

    $this->quoteRepository = $quoteRepository;

}

/**
 * {@inheritdoc}
 */
public function get($cartId)
{
    /** @var  \Magento\Quote\Model\Quote $quote */
    $quote = $this->quoteRepository->getActive($cartId);

    return $quote->getCouponCode();
}

/**
 * {@inheritdoc}
 */
public function set($cartId, $couponCode)
{
    /** @var  \Magento\Quote\Model\Quote $quote */
    $quote = $this->quoteRepository->getActive($cartId);
    if (!$quote->getItemsCount()) {
        throw new NoSuchEntityException(__('Cart %1 doesn\'t contain products', $cartId));
    }
    $quote->getShippingAddress()->setCollectShippingRates(true);

    try {
        $quote->setCouponCode($couponCode);
        $this->quoteRepository->save($quote->collectTotals());
    } catch (\Exception $e) {
        throw new CouldNotSaveException(__('Could not apply coupon code'));
    }
    if ($quote->getCouponCode() != $couponCode) {
        throw new NoSuchEntityException(__('Coupon code is not valid or expired'));
    }
    return true;
}

/**
 * {@inheritdoc}
 */
public function remove($cartId)
{
    /** @var  \Magento\Quote\Model\Quote $quote */
    $quote = $this->quoteRepository->getActive($cartId);
    if (!$quote->getItemsCount()) {
        throw new NoSuchEntityException(__('Cart %1 doesn\'t contain products', $cartId));
    }
    $quote->getShippingAddress()->setCollectShippingRates(true);
    try {
        $quote->setCouponCode('');
        $this->quoteRepository->save($quote->collectTotals());
    } catch (\Exception $e) {
        throw new CouldNotDeleteException(__('Could not delete coupon code'));
    }
    if ($quote->getCouponCode() != '') {
        throw new CouldNotDeleteException(__('Could not delete coupon code'));
    }
    return true;
}
}

I am able to print values inside get function but the set function is still returning value from vendor file.

Please help.
Thanks


texts: Insert widget is not working on content page

texts:
I am new to Magento. I am trying to add new widget on content page, So i followed the path
CMS-->PAGES-->HOME-->CONTENT
In this, I clicked on  "Insert Widget", But i shows empty window as shown in the image.

I also cleared "Cache", But could not find the issue. Please assist me for a solution.
Many Thanks


texts: Magento Product View Details Not loading Properly

texts:
In my magento website, whenever i am trying to view the product details page,its not loading the product details page properly,after the Product Image its not displaying anything.

Solution:

The problem has been resolved by increase the memory size .
ex: 'ini_set('memory_limit', '128M');'


texts:
I have a problem with aligning the content of my top_links.phtml

Using the Ultimo theme, I have added flags to the store switcher using the following code:

<?php
/**
 * Language switcher template
 *
 * @see Mage_Page_Block_Switch
 *
 */
?>
<?php if(count($this->getStores())>1): ?>
    <?php
        $currStoreName = '';
        $currStoreCode = '';
        $html = array();
        $html[] = '
';
        foreach($this->getStores() as $_store)
        {
            $storeName = $this->__($this->escapeHtml($_store->getName()));
            $storeId = $_store->getId();
            $storeCode = $_store->getCode(); //$storeCode = Mage::getStoreConfig('general/locale/code', $storeId);
            $css = 'style="background-image:url('. $this->getSkinUrl('images/flags/'. $storeCode .'.png') .');"';

            if($storeId == $this->getCurrentStoreId())
            {
                $currStoreName = $storeName;
                $currStoreCode = $storeCode;
                $html[] = '
&nbsp;'. $storeName .'
';
            }
            else
            {
                $html[] = '
getCurrentUrl() .'">&nbsp;'. $storeName .'
';
            }
        }
        $html[] = '
';
    ?>

<?php if (count($this->getStores()) > 1): ?>

            <?php foreach ($this->getStores() as $_lang): ?>
                <?php $selected = $_lang->getId() == $this->getCurrentStoreId() ?>
                <a class="lang-flag<?php $selected && print ' selected' ?>" href="<?php echo $_lang->getCurrentUrl() ?>">
                    <img src="<?php echo $this->getSkinUrl('images/flags/' . $_lang->getCode() . '.png');?>"
                        alt="<?php echo $this->htmlEscape($_lang->getName()) ?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>">

            <?php endforeach ?>

<?php endif ?>

I have then moved the language switcher to the top_links.phtml using:

<?php echo $this->getChildHtml('store_language');?>

In general, that works. However the alignment when moving to smaller screens is total chaos, as can be seen the image here: http://imgur.com/rJHehur

At ipad size, the icons are a mess. At iphone size, the alignment is not great.

I'm not great at css. Obviously my theme (Ultimo) is doing the responsiveness for the site overall.. but my flags and top links are needing cleaning up.

Any tips on how the flags can be forced to stay together as a block.. and have it better aligned etc?

Thanks.


texts: How to define image, small_image, etc. automatically/programmatically

texts:
i noticed a strange behaviour of magento today. I have an online website  where people can buy online. Some products came without image. Thay are showing only the magento logo. How is this possible? What do you suggest in this case?
Thank you in advance!


texts: How to Remove Custom Layout Updates in One Go

texts:
On products I set custom product updates I also did on catogories pages, but now I need to remove them because this is interfering with my new theme...

Product;
Page Layout - 2 columns with left bar

Catogories;
Page Layout - 2 columns with left bar

I need to remove these updates on all..

Thanks


texts: How does Magento prevent two products with same sku being saved?

texts: What code is being used to prevent two products with same sku from being saved, is it at the attribute level (setting it as unique) or is there some other code being used?


texts: Make Magento aware of new translations csv files

texts:
My translations work as long as I copy/paste an existing Mage_*.csv file into my locale/{lang}/ folder. From there, I can delete what I don't want to override, add new text to work with my modules, etc.

I want to add my own file, like translations.csv and have it just pull from there. How do I make Magento 1.9 aware of this file? I'd like to have module-specific csv files to keep things separated, like PackageName_ModuleName.csv, and all my translations for that particular module live in that file.

Thanks!


texts: Plugin isn't working in Magento2 local host

texts:
My very basic plugin is not working and i can't understand why. I'm very new to Magento 2 so it's probably something simple. The Plugin is suppose to display "Too expensive" or "too cheap" on all products.

di.xml code

<config>
<type name="Inchoo\Custom\Plugins">
    <plugin name="Product" type="Inchoo\Custom\Plugins\Product" sortOrder="1"
disabled="false"/>
</type>
</config>

Product.php code

<?php

namespace Inchoo\Custom\Plugins;

Class Product {
public function aftergetName(\Magento\Catalog\Model\Product $product, $name)
{
  $price = $product ->getData(key:'price');
  if ($price < 60 ) {
    $name .= " So cheap" ;
}
  else {
    $name .= " Too expensive";
}

  return $name;
    }
}

Any help would be much appreciated. Thanks in advance, Greg


texts:
when I try to log in as a customer to shop I got notice error:

  "An unspecified error occurred. Please contact us for assistance."

When I register as a new customer to shop it seems to work ok - when I am automatically logged in after registration. When I try to re-login I get an error as above. Anyone also met such issue before?

link to shop: http://new.beautywebshop.be
My Magento version is Magento 2.1.7


texts:
The webhost which looks after a magento instance messed up all of the file ownerships and permissions. They have now stated they have sorted it out and we can now FTP in and upload files. The issue we have now though is that when a customer updates the quantity in the cart it doesnt work.

Looking at other posts it would seems to lead to the form_key field however I can see this field in the source code eg:

<form action="https://www.example.co.uk/checkout/cart/updatePost/" method="post">
<input name="form_key" type="hidden" value="BRTMA77qNzgbkgDT" />

So I dont believe its that.

I have tried to clear all magento and browser cache but no luck. Has anyone got any suggestions.

Update
I think the issue is with _validateFormKey function in /app/code/core/Mage/Core/Controller/Varien/Action.php

If I dump out the values

zend_debug::dump($_POST);
zend_debug::dump($this->getRequest()->getParam('form_key', null));
zend_debug::dump(Mage::getSingleton('core/session')->getFormKey());

I get

array(0) {
}
NULL
string(16) "BRTMA77qNzgbkgDT"

So it looks to me the POST is being cleared but not sure why


texts: Can't login in admin panel through firefox and chrome (Opera is fine)

texts:
Suddenly I can't no longer access the admin panel from chrome and firefox with magento 1.9.2.2, however chrome is fine.

Settings(Magento url: www[dot]farmaciacaloini[dot]com[slash]shop):

web/session/use_http_via                0
web/session/use_http_x_forwarded_for    0
web/session/use_http_user_agent         1
admin/security/use_form_key             1

admin/security/session_cookie_lifetime  86400
web/default/cms_no_cookies              enable-cookies
web/cookie/cookie_lifetime              86400
web/cookie/cookie_path                  [slash]shop
web/cookie/cookie_domain                [dot]farmaciacaloini[dot]com
web/cookie/cookie_httponly              0
web/cookie/cookie_restriction           1

Observation:

If the credentials are wrong then the message shows up
If the credentials are corect the page quickly refreshes and deletes all the cookies
I have cleaned session and cache folders and memcache and mod_pagespeed cache
The hidden input form_key is present
It has worked since some days ago, I haven't done any changes to cookies setting, maybe I have changed some values to the security option, but I'm not sure


texts: Filter Price now showing on multiple websites using elastic search 6 +

texts:
Currently after 2.3.1 magento upgrade I start to use elastic search 6.
On my magento application i have multiple websites and for some reason, except the default website the price filter was not showing at all.
I start to debug this issue and i found a solution.

I will post my solution, because maybe in the future someone will have exact same issue.


texts: Add parameter to request using JavaScript

texts:
Is there a way to add information to the post request which will be sent when I press the "save product" button? I have added some custom things to the product I need to transmit in order to process them (using the catalog_product_prepare_save event).
I have a dropdown menu next to a button, and when I press that button, I need to transmit the content of the dropdown via the request array so that I can receive the option selected in the observer I have registered.

Thanks a lot in advance

EDIT: I have a feeling there is something completely wrong about the way I'm approaching this, a nudge in the right direction would be much appreciated, I'm quite stuck atm.


texts: Magento becomes unresponsive / hangs while trying to save config in System > Configuration > Payment methods

texts:
currently i have two payment methods for my site .
cash on delivery is working fine.
but when i try to make payment using payumoney. then after placing the order it should redirect to payumoney website for final payment . but it gets redirected to shopping cart.

one more problem has arised
when i go to System > Configuration > Payment methods
and make some changes . say activate or deactivate some payment methods and hit save config the that page becomes unresponsive & struck for sometime but other tabs work fine .moreover the changes never gets saved .


texts:
Where is the patch 5994 for Magento 1.5.1.0 ?

I cannot find it in the download page, only patches availables for versions 1.5.0.0, 1.5.0.1 and 1.5.1.1.

I think it the same case as before : the patch is missing.


texts: how to get special price and regular price in phtml file magento2

texts:
i have a phtml file where i want to get special and regular price of product im using product model but getting nothing, im using this code:
$product_id =$block->getProduct()->getId();
$_product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

$orgprice = $_product->getPrice();
$specialprice = $_product->getSpecialPrice();


texts: Magento 2 Admin Url or any other URL you are requesting not found on server 404

texts:
I tried all possible solutions on the internet but the still issue persists.
Solutions that tried
1. ( Many solutions suggest changes in apache in following files ) /etc/apache2/apache2.conf
Enabling apach2 rewrite mode first a2enmod rewrite

Changing from
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

to
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

This sometimes works but in my case no luck
2. Using /index.php/ after base URL for instance magento.com/index.php/admin

In this case, few links were able to open but the admin was not opening


texts: Magento 2 can't remove post params when reload

texts:
I'm trying to import stock using csv. When I click on submit, the import functionality works fine. But when i click on reload when it is posting then it loads until the post function completes.

<?php
if(isset($_POST['submit'])){
    if (!file_exists($mediaPath.'csv')) {
        mkdir($mediaPath.'csv', 0777, true);
    }
    $file_type = $_FILES['file']['type']; //returns the mimetype
    $allowed = array('text/csv');
    if(!in_array($file_type, $allowed)) {?>

Only CSV files allowed

        Wrong format
        Wrong format
        Wrong format

    <?php
   $model->addData([
    "title" => 'Title 01',
    "content" => 'Content 01',
    "summary" => "true",
    "create_at" => new \Zend_Db_Expr('NOW()')
    ]);
    $saveData = $model->save();

    }else{
    $displayFlag = 1;
    $csv =  $_FILES['file'];
    $targetdir = $mediaPath;
    $image_name=$_FILES['file']['name'];
    $temp = explode(".", $image_name);
    $newfilename = round(microtime(true)) . '.' . end($temp);
    $imagepath=$mediaPath."csv/".$image_name;
    if(move_uploaded_file($_FILES["file"]["tmp_name"],$imagepath)){
        $csvFile = file($imagepath);
        $data = [];
        foreach ($csvFile as $line) {
            $data[] = str_getcsv($line, ",", '"');
        }
        $keys = [];
        $result = [];
        foreach($data as $key => $value){
            if($key == 0){
                $keys = $value;
            }
        }
        foreach($data as $key => $value){
            if($key !== 0){
                $result[] = array_combine($keys, $value);
            }
        }
        foreach($result as $key => $value){
            if(isset($value['sku'])){
                if($product->getIdBySku($value['sku'])) {
                    $stockItem = $stockRegistry->getStockItemBySku($value['sku']);
                    $stockItem->setQty($value['qty']);
                    $sku = $value['sku'];
                    if($stockRegistry->updateStockItemBySku($sku, $stockItem)){
                        ?>

                            <?php echo $value['sku'] ?>
                            <?php echo $value['qty'] ?>
                            Updated

                    <?php
                    }else{?>

                            <?php echo $value['sku'] ?>
                            <?php echo $value['qty'] ?>
                            Updated

                        <?php
                    }
                }else{ ?>

                            <?php echo $value['sku'] ?>
                            <?php echo $value['qty'] ?>
                            Sku Not found

                <?php
                }
            }else{
                ?>

Only CSV files allowed

                        Wrong format
                        Wrong format
                        Wrong format

            <?php
                break;
            }
        }
    }
}
header('Location: http://192.168.31.236/magento/admin/grid/grid/index');
exit();
}
?>

I can't load any admin pages until this post function completed.


texts:
Is it possible to setup tax for selected products in USA and all products in Canada ? If I set tax class to all products for canada, it also apply the same for USA.

Thanks


texts: How to disable "save address book" in checkout process?

texts:
I basically want to disable this section where it asks the logged in user whether "Select a billing address from your address book or enter a new address."

I have tried removing the condition in billing.phtml but then it will just appear blank. I need it to take the logged in user to the exact same process as guest users (display the billing form automatically).

Here is the condition in billing.phtml:

<?php if ($this->customerHasAddresses()): ?>

            <?php echo $this->__('Select a billing address from your address book or enter a new address.') ?>

                <?php echo $this->getAddressesHtmlSelect('billing') ?>

    <?php endif; ?>

I'm sure there is more than just removing this block of code...


texts: Set Default Billing Address as Billing Address via knockout on checkout page

texts:
The Checkout page is currently loading Shipping address as billing and shipping address. I want to load default billing address on checkbox click and set it to order before save.
I dont know how to do it.

I tried and found a way to get default billing address through

var defaultBillingAddressese = addressList().filter(function (address) {
            return  address.getType() == 'customer-address' && address.isDefaultBilling();
        });

This line of code returns default billing address now i want to set it to order in billing-address.js.

  app/design/frontend/Capitol/luma-child/Magento_Checkout/web/template

 <input type="checkbox" name="billing-address-same-as-shippings"
                 data-bind="click: updateAddress, attr: {id: 'billing-address-same-as-shippings'}" style="visibility: hidden"/>

    <fieldset class="fieldset" data-bind="visible: !isAddressDetailsVisible()">

                <button class="action action-update" type="button" data-bind="click: updateAddress">

                </button>
                <button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit">

                </button>

    </fieldset>

  billing-address.js

updateAddress: function () {
var defaultBillingAddress = addressList().filter(function (address) {
                return  address.getType() == 'customer-address' && address.isDefaultBilling();
            });
           },


texts: How to handle translations with translation bureaus?

texts:
I'm wondering what's the best way to realise translations with translation bureaus.

Basically I see two ways of doing this:

Send them the CSV files.
Give them access to a Magento installation for inline translation.

The issues that can occur:

CSV files

Quite many agencies prefer "professional" file formats like .pot / .po (GetText).
The context for the strings to be translated is missing.
Not every text can be found in CSV files (CMS block, CMS pages, ...).

inline translation

Not every agency wants to learn how to use the Magento backend
It's difficult to reproduce all scenarios for translatable texts (think error messages e.g.)
I want my translations to be in versionable file instead of the database. (Ok, you can work around that and extract the translations from the DB to files.)

All in all this seems to be time-consuming and error-prone. Am I missing something obvious here?


texts: Magento 2: The dropdown menu for client and admin does not work

texts:
The menu does not load the submenus nor for the admin.
just show this error;
Refused to load the script https://ajax.cloudflare.com/cdn-cgi/scripts/7089c43e/cloudflare-static/rocket-loader.min.js


texts: Elastic Search (v7) changing Magento default product sort position in categories

texts:
We have installed Elastic Search 7 on a server running a Magento 2.3.5-p1 store and we can test it is successful (both in Magento 2 backend and on CLI) but when it is enabled, it changes the default product sort position in categories so that the oldest products appear first and the newest last.
When it is disabled (i.e. search set to MySQL), the default sort position is correct with newest products listed first.
This is when the sort position is set to the same for a range of products.
So if 6 products in a category all have the default position of 0 set, with Elastic Search enabled, the oldest of those 6 products is appearing at the top for some reason...
Is this normal and what is meant to happen with Elastic Search? Bear in mind, I'm not even on a search page, this is just default view in categories.
Any idea why this is being changed and what needs to be done to show newest products first like would be expected? I am not really sure where to begin with this, whether a change needs to be made or whether this doesn't sound right.


texts: Strip index.php from Magento nginx github configuration

texts:
I am currently on a Magento-1.9.2.2 with Nginx 1.6.2 and using Magento Nginx Github Conf and

shop.com takes me shop.com
But if I click any link, I see a structure like:
shop.com/index.php/category1
shop.com/index.php/product-details-1

How could I get rid of the index.php without breaking some other parts of the shop?

location / {
            index index.html index.php;
            try_files $uri $uri/ @handler;
            expires 30d;
    }

location @handler { ## Magento uses a common front handler
            rewrite / /index.php;
    }


texts: Magento 2 - Custom input when Add To Cart

texts:
Is it possible to add a custom step before the product is added to the cart?
What I want to do is:

add a custom form to fill in extra information for the product
the extra information will be associated with the product and being processed in the checkout process


texts: Adding Input Box Shipping Module Backend

texts:
I am creating shipping module. Here I am trying to add input box from block, Which I have created here

app/code/local/Namespace/module/Block/System/Config/Form/Field/Fieldtype.php

class Namespace_Module_Block_System_Config_Form_Field_Fieldtype extends Mage_Adminhtml_Block_System_Config_Form_Field {

    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
        $key = 1;
       $value="test";
        $input = '<input id="module_fieldtype_'.$key.'" name="groups[module][fields][fieldtype][value]['.$key.']" value="'.$value.'" class=" input-text" type="text">';
        return $input;
    }
}

And at app/code/local/Namespace/Module/etc/system.xml

<fieldtype translate="label">
    <label>Multipliers</label>
<frontend_model>namespace_module/system_config_form_field_fieldtype</frontend_model>
                            <sort_order>170</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>0</show_in_website>
                            <show_in_store>0</show_in_store>
                            <can_be_empty>1</can_be_empty>
                        </fieldtype>

And at app/code/local/Namespace/Module/etc/config.xml

< config>
    < modules>
        < Namespace_Module>
            <version>0.1.0</version>
        </Namespace_Module>
    </modules>
    <global>
        <models>
            < namespace_module>
                <class>Namespace_Module_Model</class>
            </ namespace_module>
        </models>
        < helpers>
            <namespace_module>
                <class>Namespace_Module_Helper</class>
            </namespace_module>
        </helpers>
    </global>
    <default>
        < carriers>
            < namespace_module>
                <active>1</active>
                <sort_order>1</sort_order>
                <model>namespace_module/carrier</model>
                <title>Namespace Module Carrier</title>
                <sallowspecific>0</sallowspecific>
                <express_max_weight>1</express_max_weight>
            </ namespace_module>
        </ carriers>
    </ default>
</ config>

now when I refreshed page, it is giving me error

Fatal error: Class 'Mage_Namespace_Module_Block_System_Config_Form_Field_fieldtype' not found

Can anyone guide where I have mistaken or what is missing !!!


texts: Magento 2 Calling widget/template_filter in .phtml

texts:
Where is the equivalent way of writing the following Magento 1 code for calling a custom widget in Magento 2.3.1?

Mage::getSingleton('widget/template_filter')->filter($_product->getData('variants'))


texts: Get product categories for specific store in magento 2

texts:
I want to get category names assigned to particular product for current store.
I have 2 store wholesale ans retail.
I want to get the category name assigned to a product for retail store only. how can i do that?
I tried using object manager, below is my code. it fetches the category from both the store for now. but i want only for current store.
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')-
>registry('current_product');//get current product
$categoryCollection = $objectManager-
>get('\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory');
$productRepository = $objectManager->get('\Magento\Catalog\Model\ProductRepository');
  $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');

$storeId = $storeManager->getStore()->getStoreId();

$productId =  $product->getId();
$product = $productRepository->getById($productId);

 $categoryIds = $product->getCategoryIds();

$categories = $categoryCollection->create()
                             ->setStoreId($storeId)
                             ->addAttributeToSelect('*')
                             ->addAttributeToFilter('entity_id', $categoryIds);
        ?>


texts: What does each column tag attribute represent?

texts:
I see that the grid columns in Magento 2 that are declared via ui-components support the following tags:

name - identifier of the column
class - class used for preparing the data displayed in the column
disabled - can be used to disable a grid column
dataSource - ?
layout - ?

As shown above, I (think I) know what 3 out of 5 attributes do and mean.
What do the dataSource and layout attributes do and mean?


texts: Magento 2.3 How to change the order of customer account form fields with custom module?

texts:
I created the module name "Name_Module", Now I want to change the order (position) to " create customer account form fields ". How could I achieve this functionality?

Also, need to check if the module is enabled then change the order(position).

Thanks in advance.


texts: Order not processing in backend, but processing with gateway (Unique Constraint Violation Found)

texts:
New Magento 2 Install. Authorize.net and Paypal having the same issue.

Order is placed on our website
Payment is captured and accepted
The order DOES NOT show up in Magento`s backend.
Customer does not receive any confirmation emails

Making big problems for us at the moment. I tested it myself, and after it processed the credit card through authorize.net and captured the payment. I had a brief error that said, "Unique Constraint Violation Found". Then went away and stayed on the checkout page.

We need these orders to process in magento back it's like it's not poling the data into the order form?

Not even sure where to look for this, or begin to fix it, there's no real supported threads answering this question, can anyone offer guidance?

-Justin

UPDATE: When credit card used with authorize.net it will allow me to authorize/capture or void the card, however when paid with paypal, it will be stuck on authorization/pending as if it's waiting for information from magento store. Please advise


texts: Combine referenceBlocks from 2 custom module into 3rd layout xml...Possible?

texts:
How to use two  from 2 different modules and call them in the 3rd layout?

say for eg:

From CatalogSearch module, catalogsearch_result_index.xml has

<body>
    <referenceBlock name="search.result">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Module1::result.phtml</argument>
      </action>
    </referenceBlock>
</body>

From CatalogLayeredNavigation module, same xml catalogsearch_result_index.xml has

<body>
    <referenceBlock before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Module2::layer/view.phtml</argument>
      </action>
    </referenceBlock>
</body>

Can i combine the referenceBlocks in Module3 as :

 <body>
    <referenceBlock name="search.result">
      <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_Module1::result.phtml</argument>
      </action>
    </referenceBlock>

    <referenceBlock before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_Module2::layer/view.phtml</argument>
      </action>
    </referenceBlock>
</body>


texts: Magento 2 : Get shipping method using observer

texts:
I am trying to get the the shipping method using observer but I cant seem to get it to work, this is what I have for the ShippingTypeEmail.php
<?php

namespace vendor\Emails\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Sales\Model\Order;
class ShippingTypeEmail implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)

    {
    $shpvar =''
    $order = $observer->getEvent()->getOrder();
    $ShpMethod = $order->getShippingMethod();
    if($ShpMethod == 'flatrate_flatrate'){
      $shpvar = 'flat'
    }else{
        $shpvar = 'collect'
    }
    }
}

Then I am using {{var shpvar|raw}} on the template
my event.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <event name="email_order_set_template_vars_before">
        <observer name="vendor_emails_variable_order" instance="vendor\Emails\Observer\ShippingTypeEmail" />
    </event>
</config>


texts: What is the main differences of community and Enterprise indexing and caching?

texts:
Can anyone simply explain what are the caching mechanisms and indexing processes in Magento Community and Enterprise Editions? There are some articles out there regarding this. But still what are the significant differences?
And how they are differ in each editions?


texts: How to show an attribute on a product page outside view.phtml?

texts:
I want to echo an attribute from a product on the productpage, but not exactly on view.phtml but in tabs.phtml which is loaded into view.phtml with getChildHtml.

In view.phtml I can use

echo $_product->getResource()->getAttribute('videotab')->getFrontend()->getValue($_product)

But when I do the same in tabs.html I get the following error:

  Fatal error: Call to a member function getResource() on null in

How can I echo the product attribute there? I need to add the data inside a tab, so it needs to be loaded inside tabs.phtml


texts: I want to remove signin and create account link and add 2 new custom links in place of that magento 2.1.3

texts:
I have removed link successfully but not able to see the new links.
I have added code in app/code/namespace/customer/view/frontend/layout/default.xml

 <referenceBlock name="header.links">
               <!-- Contact us Link -->
            <block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="false">Constact Us</argument>
                    <argument name="path" xsi:type="string" translate="false">contact-us</argument>
                </arguments>
            </block>
            <!-- CMS Page Link Link -->
            <block class="Magento\Framework\View\Element\Html\Link" name="aboutus.link" after="contactus.link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="false">about Us</argument>
                    <argument name="path" xsi:type="string" translate="false">about-us</argument>
                </arguments>
            </block>

             <!--  you can easly Remove  links with following code -->
            <referenceBlock name="register-link" remove="true" />           <!--for Create Account Link-->
            <referenceBlock name="authorization-link" remove="true" />      <!--for Sign In Link  -->
            <referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
            <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->

        </referenceBlock>


texts: Error during compilation [ReflectionException] M2.1.7

texts:
relatively new install of M2.1.7, getting a compilation error which is preventing setup:di:compile and switching between production/developer mode. Any ideas? Can't seem to find much... Thanks in advance

Compilation was started.
Area configuration aggregation... 5/7 [====================>-------]  71% 38 secs 230.0 MiBMiB

[ReflectionException]
  Class Doctrine\Common\Cache\Cache does not exist

[ReflectionException]
  Class Doctrine\Common\Cache\Cache does not exist

setup:di:compile


texts: magento text field add dropdown value from some other database

texts:
i want to add dropdown to magento custom forms fields
see below

$fieldset->addField('cadmin', 'text', array(
            'name'  => 'cadmin',
            'label' => 'Corporate Admin',
            'id'    => 'cadmin',
            'title' => 'Corporate Admin',
            'required' => false,
        ));

i want to show dropdown with values from database , bascially i want to show all customer group in drop down here , how can i do it


texts: Magento 2 Cookies break login on subdomains

texts:
I have a magento 2 install running on domains like this:

site.com
business.site.com

If you go directly to the subdomain you can login without issues but if you visit the primary domain at all cookies will be created that block you from creating session ID cookies for the subdomain. This prevents you from logging in.

Doing a little tracking it seems it does log in successfully and redirects to the account page. But then finds it isn't logged in (cookie issue) and redirects again.

After some investigation I found some people encountering similar issues in M1 What's the correct cookie config for a Magento site split across multiple instances as subdomains?

The advice was to change the cookie settings and possibly add a "." before the domain. I have tried the solution mentioned and various different variations and the results did not help

Primary Domain:
site.com - default does nothing
.site.com - breaks login for main site

Subdomain:
business.site.com - default encounters issue
.business.site.com - breaks login for subdomain site
.site.com - similar issues to default value. Direct visting works. visiting main site means the first login will fail on subdomain but subsequent logins work. logging in on main site front end will make it impossible to login on subdomain (even if you log out) until you clear cookies.

I think the only solution I have left is to switch the default site to "www.site.com" but this is not desired by the client.

Am I missing some step or doing something wrong with the "." solution or has something changed in magento 2 to make this not work anymore.


texts:
In my .phtml i have:

require([
'jquery'
], function ($) {
 $.ajax({
        url: "get_shipment_info.php",
        type: "get", //send it through get method
        data: {
            company: ManiFacturerName
        },
        success: function(response) {
},
        error: function(xhr) {
            console.log("ERR");
            //Delete the object
            var element = document.getElementById('shipment_info');
            element.parentNode.removeChild(element);
        }
  });
});

The php file

url: "get_shipment_info.php",

is just echo "1";
The problem is i get the response after 7seconds. I dont know why...


texts: Error when upgrading from 2.2.6 to 2.2.7

texts:
I'm trying to upgrade 2.2.6

When I run the web setup wizard I get this response.

Check Component Dependency

We found conflicting component dependencies.

Command "update" failed: Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1

- magento/product-community-edition 2.2.7 requires composer/composer 1.4.1 -> satisfiable by composer/composer[1.4.1].
- magento/product-community-edition 2.2.7 requires composer/composer 1.4.1 -> satisfiable by composer/composer[1.4.1].
- Conclusion: don't install composer/composer 1.4.1
- Installation request for magento/product-community-edition 2.2.7 -> satisfiable by magento/product-community-edition[2.2.7].

When I try the command line upgrade I just get memory errors due to forkbomb protection.

My composer version is 1.6.4 so newer than 1.4.1

The site is on shared hosting so I can't downgrade or upgrade composer.


texts:
I'm on Magento 1.9.2.2 and getting the static block bug. As a work around I disable the blocks html cache, the problem goes away.

But every day something goes in and the block html cache gets invalidated and the bug reappears. I then have to disable the block html again,  and the next day again, and the next day again.

I'm no programmer. How do I disable the cache permanently so it doesn't refresh and go into invalidate state?

I just want this bug to go a way so people can use my site.


texts: Delete all order,invoice,credit memo, and shipment in magento 2

texts: How to delete all magento 2 order, invoice, shipment, and credit memo, and reset the increment_id too using php code?


texts: How to pass variable between observers magento 2

texts: I want to pass variable (estimated shipping address) from observer of event checkout_submit_before to observer that belong to event payment_method_is_active  so how to proceed please


texts: Custom header navigation link and sort order

texts:
I'm trying to add a custom CMS page link (home) to the navigation menu which was successful using the following code in layout/default.xml

    <referenceContainer name="catalog.topnav">
      <block class="Magento\Cms\Block\Block" name="home-link" before="-">
        <arguments>
          <argument name="block_id" xsi:type="string">home-link</argument>
        </arguments>
      </block>
    </referenceContainer>

However - the link is simply added to the end of the menu. I would like, if possible to be able to display this as the first link.

Can anyone help please?


texts:
When using Paypal express, the shipping options shown in Paypal are not the clean the versions that the customer should see. Instead they see options like -

matrixrate_matrixrate_3378 Select Sh: £5.00 GBP

matrixrate_matrixrate_3374 Select Sh: £5.00 GBP

matrixrate_matrixrate_3373 Select Sh: £9.99 GBP

freeshipping_freeshipping Free - Sto: £0.00 GBP

I'm aware that this is a known problem, but I haven't found answers on how to correct it, or even choose not to display the shipping options in Paypal.

Anyone have any ideas?

Thanks


texts: Magento 2 : How to Get all User Defined Attributes in Product Model

texts:
I need to get all attributes of catalog_product - entity_type_id which are user defined. I can do this via eav/config analogue in Magento 1, but how can do this in Magento2  ?

Something like this query should do:

SELECT *
FROM eav_attribute
WHERE entity_type_id = 4 AND is_user_defined = 1;


texts: How to override both shipping.html and shipping.js file in custom module magento 2

texts:
override both shipping.html and shipping.js

I am trying to override shipping.js file in magento 2 but can not working.

requirejs-config.js

var config = {
paths: {
    'Magento_Checkout/template/shipping': 'VendorName_Namespace/template/shipping',
    'Magento_Checkout/js/shipping': 'VendorName_Namespace/js/shipping'
    }
};


texts: Multiple Pricing Discount Promotions w/o Coupon Code

texts:
I am trying to do something that seems like it should be simple, but I can't get it to work. I am trying to write 3 Shopping Cart level pricing rules for the following scenarios:

5% off over $45
10% off over $65
15% off over $100

The rules should cancel each other out to function properly. For example, if someone spends over $100 they should only get 15% off their total and not the combination of all rules: 30%.

Anybody know a way to do this?


texts: Added header link shows a second logout link next to it

texts:
I'm trying to add a link next to the logged in user dropdown menu.
Apparently the "Sign In or" part of "Sign In or Create an account" is not removed after logging in, but simply hidden.

When I add a custom link, the "Sign Out or" text becomes visible:

Here is the generated html where the top link shows up in the dropdown after logging in, the bottom link is the login link that is usually shown when not logged in but now invisible.

        Sign Out

        Sign Out

After adding my custom link the generated html looks like this, and the "Sign Out or" text is visible next to my custom link.

        Sign Out

Partner Portal

        Sign Out

My App\Code\Company\Module\view\frontend\layout\default.xml file looks like this:

<?xml version="1.0"?>

    <referenceBlock name="header.links">
        <block class="Company\Module\Block\Portal\PortalLink" name="partner_portal">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Partner Portal</argument>
            </arguments>
        </block>
    </referenceBlock>

And my link class:

class PortalLink extends Link {
    protected $_session;

    public function __construct(Context $context, Session $session, array $data = []) {
        parent::__construct($context, $data);
        $this->_session = $session;
    }

    public function getHref() {
        return "/partner-portal";
    }

    protected function _toHtml() {
        if ($this->_session->getCustomerGroupId() == 3) {
            return parent::_toHtml();
        }

        return '';
    }
}

I tried editing the sign out link to return nothing when the user is logged in but that also removes the sign out link from the dropdown. I'd also rather not change anything in the Magento code because I'd like to be able to install my module on a clean install.


texts:
I am trying to change per page option in magento 2 on product listing page

Currently its 9, 15, 30 by default in toolbar
I want to change it to 12, 24, 48, 96 etc

Any help will be appreciated


texts: How can I set the minimum order amount from a certain country

texts:
I see how I can set the minimum order for all customers, but how can I do this for customers for a certain country, for example France?

In the promotions tab I can set a promotion for a certain country, I would like to know how to do the same for a minimum price.


texts: Where I can change the text in the PDF invoice?


texts: Indexers are locked automatically: what makes indexers to be locked in Magento 2?

texts:
What makes indexers to be locked in Magento 2?
What are use cases make the indexers to be locked?

In some cases the indexers are locked automatically, how can we stop this indexers to be locked, what are possible reasons to cause this?


texts:
I want to load all product in grid, here is option 20,30,40,50,100,200.
so i want to add one more load all option. can it possible?


texts: Convert fixed price bundles to dynamic priced bundles

texts: I need to convert a fixed price bundle to a dynamic price bundle. Does anyone have a solution that is easy to implement on bulk?


texts: Product attribute information is not saving in the product

texts:
We use magento 2 and i recently updated the product attributes for the products. Now the new product attributes I created are not saving the content. I have the problem for the attributes price, text, dropdown. The others I didn´t check. I also only have the problem with product attributes I created one week ago. All attributes I created before are working.
Can anybody help?


texts:
I am trying to solve a backend warning which is shown whilst trying to edit any configurable or simple product in my Magento 2 backend. The warning is:

  Cannot gather stats! Warning!
  stat(): stat failed for /opt/lampp/htdocs/magento2/pub/media/catalog/product/t/a/sample_image.jpg

I've seen the discussion here with regard to this problem to attempt to resolve this warning. However I don't want to change my core files. Is there any other option to solve this?


texts: Magento 1.9.3.4 huge CAPTCHA images folder

texts:
We have 150.000 captcha images on media/captcha/base folder.
We are using Magento 1.9.3.4.
We know there should be a cronjob to clear unused captcha images, but I don't know how to find it, or how to find the log to detect the problem.

I have gone through this threads/posts but they are for Magento 2:

Why is Captcha folder so large?
https://www.mynameisvolkert.com/12-000-000-unxepected-magento-captcha-files/
https://community.magento.com/t5/Magento-2-x-Technical-Issues/Captcha-Base-folder-Large-Capacity/td-p/107265

We don't have this folder structure to check our cronjob is there: vendor/magento/module-captcha/etc/crontab.xml

What can I do to solve this situation?
Thanks,


texts: how to validate before save stocktaking in magento 2 backend

texts:
Help me ! i saved the qty successfully using ajax popup, but i want hide 2 button in popup

Close
Save

When you click the save button -> save
When you click the save Close-> not save

My jquery ajax

url = '/admin/stocktaking/index/save';
                // ajax
                jQuery.ajax({
                    url: url,
                    dataType: 'json',
                    type : 'post',
                    data: {sku: sku,qty: stocktaking},
                    showLoader: true,
                    success: function(data) {
                        console.log(data);
                        if (stocktaking >= 0) {
                            if (data.success) {
                                //popup success
                                var popup = $('
').html(data.success).modal({
                                    modalClass: 'changelog',
                                    buttons: [{
                                        text: 'Close',
                                        click: function () {
                                            this.closeModal();
                                        }
                                    },{
                                        text: 'Save',
                                        click: function () {
                                            location.href = "/admin/stocktaking/index/save";
                                            return false;
                                        }
                                    }]
                                });
                                popup.modal('openModal');
                                //end popup success
                                //popup error
                            } else if (data.error) {
                                var popup = $('
').html(data.error).modal({
                                    modalClass: 'changelog',
                                    buttons: [{
                                        text: 'Close',
                                        click: function () {
                                            this.closeModal();
                                        }
                                    }]
                                });
                                popup.modal('openModal');
                                //end popup error
                            }
                        }
                    }
                });


texts: Does anyone know the only different file(s) between Magento 1.9.2.4 and 1.9.3.0? I'd prefer to replace the updated files only when upgrading Magento rather than executing the patch file. That way I know exactly what changes are made and can be recorded. Observing the patch file is very confusing.


texts: Magento 2 Replacement for cms/template Object

texts:
In Magento 1, if you wanted to transform an arbitrary block of text, the same as the body of a CMS page or block might be changed, you could use the following model class

Mage::getModel('cms/template');

This object was also available via the CMS data helper's getBlockTemplateProcessor method.

Mage::helper('cms')->getBlockTemplateProcessor();

In Magento 2, there is no CMS data helper object.  There is also no CMS template object.

In Magento 2, if I want to transform an arbitrary string as through it were a CMS page or CMS block, how would I do that?


texts: Products not getting displayed on category page in magento 2

texts: I have used magento 2.0.2 and i have create many products by manually. but products not display on category page. Also assign in category, website, visibility, stock, and assign Is_anchor yes in category. then clear cache and indexing. can you please suggest me for resolve the issue ?


texts: what is the difference between incrementId and orderId?

texts:
how incrementId generated, how it relates to orderId

what is the best scenario to use both and why?


texts: Static block are loaded in the wrong order

texts:
I've added my code to cms.xml to display static blocks in the footer. I want them to be in the following order:

Left
Middle
Right

But when I check my site, they're loaded in this order:

Right
Left
Middle

Here is the code I use to display the blocks

<reference name="footer">
        <block type="cms/block" name="cms_footer_links" before="footer_links">
            <action method="setBlockId"><block_id>footer_links</block_id></action>
        </block>

       <block type="cms/block" name="cms_footer_middle" before="footer_middle">
            <action method="setBlockId"><block_id>footer_middle</block_id></action>
        </block>

        <block type="cms/block" name="cms_footer_right" before="footer_right">
            <action method="setBlockId"><block_id>footer_right</block_id></action>
        </block>
 </reference>

Can anybody tell me what i'm doing wrong?


texts:
A lot of core files will be patched (~76 CE, ~85 EE). If I take a look at the files I do see a lot of different modules are affected: PayPal, Newsletter, Import/Export, Authorize, Checkout, ...

I can apply the patch successfully on a dev site. But how can I check if it doesn't break anything? Placing an order works - but does it make sense to test all related modules? Or is it safe to push it live?

Thanks!


texts: Hide CMS static block programmatically in Magento 2

texts:
I need to Hide static cms block "block-id-1" from frontpage programmatically customer group based. I need to add event to hide cms static block or any other method. I want to use admin interface to enable/disable customer group to hide "block-id-1".
Content of block-cms-id-1 is button which is currently display for all customer group on checkout/cart
Mainly I need to connect this block id to customer group which can be enable from admin>configuration>extension_name>Hide from groups


texts:
What is the best way to add a code just after the body opening in Magento 2

I trayed

Content > design > configuration > Global > HTML Head

and added the code but not working

Also trayed to add it as a Widgets not working also.


texts: After adding this code https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/widgets/widget_tabs.html#result to your page, you will see that "active" option doesn't work, you can write 1,2,etc. and it will alway open last tab if you don't have "disabled" tabs. Does anybody found solution ? Tested on 2.3.4 and 2.3.1


texts:
Simple question, would it be possible to overwrite the templates in a 3rd party theme via the active theme?

I.e. if I have

/app/code/Vendor/SomeModule/view/frontend/templates/structure.phtml

would I be able to overwrite it via

/app/design/frontend/Me/MyTheme/Vendor_SomeModule/templates/structure.phtml

In the same way we could overwrite Magento_Modules?


texts:
I have some complicated cart validation logic that I need to check every time the qty of a product in the cart changes.  I don't need to check the logic when a product is added or removed entirely, just when the qty changes.

I am observing sales_quote_item_qty_set_after but that fires every time you load the cart, add a product, remove a product, etc. I would assume that I would want to grab the qty of all products in the cart to start with and then compare that with the items in the sales_quote_item_qty_set_after event. I should then be able to identify the product that started with a qty > 0, ended with a qty > 0, and a delta <> 0. I'm having trouble figuring out the logic for that.

Thanks,


texts: Debugging LESS files with Firebug / Chrome Dev tools Magento 2

texts:
I am trying to figure out how to display the LESS file and line number pre compilation in developer tools so that I can see where I need to be editing. I have previously got this up and running with SASS on M1 but can't figure it out with M2.

I have tried both enabling Source Maps in Chrome dev tools and installed fireLESS in Firefox however I always get the compiled file output not the original LESS file.

I can see in dev/tools/grunt/configs/less.js that Sourcemaps are enabled:

options: {
        sourceMap: true,
        outputSourceFiles: true,
        strictImports: false,
        sourceMapRootpath: '/',
        dumpLineNumbers: true, // use 'comments' instead false to output line comments for source
        ieCompat: false
    }

However this is making no difference.


texts:
My Server memory and Inputs/outputs overloaded suddenly
 my website link is https://buddsbuddy.com

to resolve this I have to log in to the server and kill PHP processes. tell me some solution for this


texts:
I am trying to use an image uploader but it is generating error

  Invalid parameter given. A valid $fileId[tmp_name] is expected.

I debugged and find out that the problem is in image uploader class of magento core.
please check my code.
my code in system.xml

<field id="image_upload1" translate="label" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
      <label>Image Upload</label>
      <backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
      <upload_dir config="system/filesystem/media" scope_info="1">categoryBanner</upload_dir>
      <base_url type="media" scope_info="1">categoryBanner</base_url>
      <comment><![CDATA[Allowed file types: jpg, jpeg, gif, png, svg]]></comment>
</field>

my code of image.php

namespace Afg\Customsettings\Model\Config\Backend;

class Image extends \Magento\Config\Model\Config\Backend\Image
{
    /**
     * The tail part of directory path for uploading
     *
     */
    const UPLOAD_DIR = '/categoryBanner'; // Folder save image

    /**
     * Return path to directory for upload file
     *
     * @return string
     * @throw \Magento\Framework\Exception\LocalizedException
     */
    protected function _getUploadDir()
    {
        return $this->_mediaDirectory->getAbsolutePath($this->_appendScopeInfo(self::UPLOAD_DIR));
    }

    /**
     * Makes a decision about whether to add info about the scope.
     *
     * @return boolean
     */
    protected function _addWhetherScopeInfo()
    {
        return true;
    }

    /**
     * Getter for allowed extensions of uploaded files.
     *
     * @return string[]
     */
    protected function _getAllowedExtensions()
    {
        return ['jpg', 'jpeg', 'gif', 'png', 'svg'];
    }
}


texts: Problema with 640 permission in uploaded files - Magento 1.9.2.3

texts:
When I do upload product images, these images are given 640 permission and do not appear in the backend. When I run magento-cleanup.php, everything back to normal and the pictures are shown.

  How to set default permission 644 of all theses images uploaded?

In the temp directory /media/temp/ and /media/catalog/product/, all images are 640 permission after upload.

Magento 1.9.2.3


texts:
i am trying to develop a custom module regarding reviews, reviews are shown in a list according to votes given to it by customers, for that purpose i altered the magento review table and inserted a new field called votes.

now the problem is that i am trying to sort the reviews according to the votes assigned to it but the reviews are ordered in the last updated review i.e the review which got last vote regardless of positive or negative, is shown on the top.
my code;

$this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
                    ->addStoreFilter(Mage::app()->getStore()->getId())
                    ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                    ->addEntityFilter('product', $this->getProduct()->getId())
                    //->addOrder('votes','DESC');
                    //->setOrder('votes', 'DESC');
                    //$_reviewsCollection->getSelect()->order('main_table.votes DESC');
                    //->setDateOrder();
                    ->unshiftOrder('votes', 'DESC')

the different sorting methods i tried are also here (commented)
Thanks in advance.


texts: Magento2.1 Unable to load phtml file in CMS

texts:
Wondering if you can help here.
I know how to load the standard login.phtml so that a frontend user can login/register to their accounts.

{{block template="Magento_Customer::form/login.phtml"}}
{{block template="Magento_Customer::form/register.phtml"}}

However, I am using a plugin that allows vendors to login, and would like to access that phtml on the CMS.  I tried using the following code that I derived from the template hints.

{{block class ="Ced\CsMarketplace\Block\Vendor\Form\Login" template="Ced_CsMarketplace::customer/form/login.phtml"}}

However, nothing loads in its place. I am able to see that customer/form/login.phtml file on the server directory structure, no issue, and it's loading fine on the standard(but ugly) login page. Is it possible that I'm missing something?

How can I troubleshoot?


texts: Magento 1.9 - CCAvenue Orders Automatically Cancelling

texts:
I have received order, if i try to take invoice its not possible to do that because of qty canceled as well as Canceled updated in Comment History,

I am using CCAvenue Payment Gateway.

How to solve the issue?


texts: Narrow-by-list containing wrong item with full page cache

texts:
On our Magento 1.9.4, we have category pages with 3 product attributes used for the narrow-by-list. E.g. in a "Fashion" category, these lists look like this:

Clothe type:
   /fashion/l/shoes
   ...
Color:
   /fashion/l/green
   ...

Now, when you click on the clothe-type=shoes link, and we also have green shoes, then the next page has a color=green link combined with the shoes filter of the current url:

Color:
   /fashion/l/shoes/green

So the product list then is filtered on multiple attributes. That works mostly like a charm here.

Now, on the /fashion page, the link for color=green sporadically includes the "shoes" filter although the current url clearly misses that shoes filter:

Color:
   /fashion/l/shoes/green

Keeping in mind that we also run a full page cache. I suppose this cache drives me crazy but I'm curious if anyone else has seen this?


texts: Image is not setting as base/thumbnail after creating product programmatically

texts:
I'm trying to set product image while creating product programmatically(on server). The image which I'm trying to set as product image is getting uploaded after product creation but it is not setting as base/small/thumbnail image.

Using below code, first I'm initialising media gallery and then adding image.And the same set of code is working in localhost not on server.On server I've changed directory permissions as well.

...
->setMediaGallery(array('images' => array(), 'values' => array())) //media gallery initialization
->addImageToMediaGallery('full path', array('image','thumbnail','small_image'), false, false)
...

As I'm not getting any exception because image is getting uploaded. Is it because of directory/file permissions.
Guys, help me to figure out what exactly the issue.


texts: magento 2 How to override module-configurable-product configurable.js file

texts:
I want to override following js core file.

public_html/vendor/magento/module-configurable-product/view/frontend

I have tried in my custom theme as follow but it is not working

public_html/app/design/frontend/TemplateMonster/theme007/Magento_ConfigurableProduct/view/frontend/web/js

i have also created required requirejs-config.js and added following code

/public_html/app/design/frontend/TemplateMonster/theme007/Magento_ConfigurableProduct/requirejs-config.js

var config = {
    map: {
        '*': {
            configurable: 'Magento_ConfigurableProduct/js/configurable'
        }
    }
};


texts: Need to add dropdown menu to magento 2 checkout page city field

texts:
I Need to Add Dropdown Menu Checkout Page City Field In magento 2

1. Could you tell me the file path of checkpout page phtml file.

2. Also need to replace postal code according to city option.


texts: How can I add the Company Name to the Billing Address information in a new order email? I would like to see the customer name, company name (which is a required field), and the rest of the address. But I'm not sure how to go about doing this?


texts: How to call a public function from another template in magento\module-catalog

texts:
i need to add div's in case of products special price in magento\module-catalog\view\frontend\templates\product\list.phtml

I'm ovverriding that file in my theme.

I may use e.g., to check for a special price, the same method used in magento\module-catalog\view\base\templates\product\price\final_price.phtml

<?php if ($block->hasSpecialPrice()): ?>
...
<?php endif; ?>

but I don't know how to call it because of different $block. How can i do it?
Thanks.


texts: Paypal Express checkout only works for base site/currency in multi-site setup

texts:
I have a site with multiple store fronts where every front has its own top level domain, language and currency. I have activated the built-in paypal express in my Magento 1.7.0.2.

Paypal now works fine as an option for my swedish front. Note that my store's base currency is in swedish currency (SEK). Paypal does not work in any other front such as the UK front which uses british pounds.

For the non-swedish fronts the checkout sends the user to a completely blank page on that front's domain such as https://ourdomain.co.uk/paypal/express/start/

Anybody with clues on what the issue could be? Is PayPal express at all meant to work on a multi-site environment? Could the problem be the currency, the different domains or something else? All ideas welcome.


texts: strange issue with date validation on language change

texts:
i am facing strange issue admin language change From Englishto Dansk (Danmark) / dansk (Danmark) give validation error.

My code

$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);

        $fieldset->addField(
            'event_start_date', 'date', array(
            'name' => 'event_start_date',
            'label' => $this->__('Start Date'),
            'image' => $this->getSkinUrl('images/grid-cal.gif'),
            // 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
            'format' => $dateFormatIso,
            'style' => 'width:161px',
            'time' => true,
            'class' => 'validate-date validate-date-range date-range-event_date-from'
            )
        );

For English

For Dutch

the difference i checked is in time  Dutch 15.29 English 15:29


texts: How to update existing custom options for product?

texts:
I have created custom options programatically with reference of below url :
https://webkul.com/blog/create-custom-option-programmatically-in-magento2/
How to update any option value or option details programatically for options which are already added in product.


texts: How to enable extension in magento 2.2.6?

texts:
How to enable extension in magento2.2.6?
Please check this screenshot.
http://prntscr.com/lho9r8


texts: Products are not shown when update the product category?

texts:
I assign a default category to show in my home page.
Ex.All Deals.

When i edit the All Deals category from the admin panel the products belongs to that category are not shown in the home page and home page shows the coming soon message.
I again go to each product and assign the category.

All the live products belongs to that category unchecked.

If any one meet the same issue can you  please explain what is happening?

magento version 1.7


texts:
here is some minor question but it always bother me while doing the code with magento.

$resource = Mage::getSingleton('core/resource');
$write = $resource->getConnection('core_write');
$table = $resource->getTableName('your/model');

$write->delete(
    $table,
    ['entity_id IN (?)' => [123, 456]]
);

$write->update(
    $table,
    ['column_1' => 3, 'column_2' => 4],
    ['entity_id = ?' => 123]
);

If I use above code to write into DB and I am not sure which query will be formed actually. How would I print the formed SQL through above write object.

I just know this one:

echo $collection->getSelect()

In which I can get the select query printed on the screen.

Can you please suggest me so that I can get the query which is going to execute or which is executed in last.

Thank you :)


texts:
How to Create New custom column in product grid in magento 2.
Thanks.


texts:
I have installed magento 2.1.7 with custom theme. Now I want to add a custom css file for modifying theme css.

In that case what's the best practice to add css file.

Create a .less file and include it
Create a .css file and include
it in layout


texts: Magento 2: SMTP Email gives error "Could not open socket"

texts:
Using Magento 2 Version 2.1.0 on WAMP Windows 10

As continue with this question Magento 2: SMTP Email gives error "Invalid sender data"

Now this is my code

    $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
    $templateId = $this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE);
    $transport = $this->_transportBuilder->setTemplateIdentifier($templateId)
            ->setTemplateOptions(['area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'store' => 1])
            ->setTemplateVars(['data' => $postObject])
            ->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
            ->addTo('xxxxxx@gmail.com')
            ->setReplyTo('xxxxx@gmail.com')
            ->getTransport();
    echo $transport->sendMessage();
    exit;

Now it's giving below error

  2 exception(s): Exception #0
  (Magento\Framework\Exception\MailException): Could not open socket
  Exception #1 (Zend_Mail_Protocol_Exception): Could not open socket

I have already followed https://stackoverflow.com/questions/28433816/how-to-fix-could-not-open-socket-in-zend-mail-zend-framework-2

But still same issue. OpenSSL is enabled on WAMP. When i'm trying to uncomment

#LoadModule ssl_module modules/mod_ssl.so

in httpd.conf & trying to restart WAMP Server. It pauses on Yellow not become Green.


texts: How would I go about updating qty through SQL?

texts: We have a custom application being written that communicates with Magento, we're looking to update inventory at a certain frequency and are looking to do this through SQL communicating directly with the database... what is the query that would update the inventory given a where clause to a product field?


texts:
I'm setting up a new Magento store and the products aren't displayed anymore. They were showing before and I haven't made big changes lately (mostely CSS)
The images were also not showing anymore, but I fixed that by renaming the .htaccess

I've done the following things:

Status > enabled
Visibility > Catalog, Search
Qty > 123
Stock Availability > In Stock
Is assigned to right category
Category is active
Disabled cache
Reindexed indices

There are no Associated Products because it are Simple Products

The strange thing is, that when I navigate directly to the product it show a blank page.
The console does show a prototype error, but that was also there when the products were showing. Here it is anyway:
    The error

Uncaught TypeError: Cannot read property 'get' of undefined

The line it refers to

var respondersForEvent = registry.get(eventName);

Does anybody know how I can get my products back?


texts: Magento 2.3: How to filter product collection by stock status

texts:
Having trouble figuring out how to filter a product collection by in stock / out of stock status. My goal is to get all out of stock products that also match some other filters:

public function __construct(
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory
  ) {
    $this->collectionFactory = $collectionFactory;
  }

$product = $this->collectionFactory->create()
      ->addAttributeToSelect('*')
      ->addFieldToFilter('quantity_and_stock_status', array('eq' => 0))
      ->addFieldToFilter('supply_discontinued', array('eq' => 1))
      ->addFieldToFilter('status', 1)
      ->addFieldToFilter('visibility', array('in' => array(3,4)))
      ->setPageSize(1)
      ->getFirstItem();

Filtering by quantity_and_stock_status doesn't seem to work in this instance. Is there another way to filter by stock status as well as the other filters I have listed?


texts: Multi Website, Different Prices, Same Domain?

texts:
We're after a multi currency, multi price, multi national Magento website on a single .com domain.

The key point is that the client wants to have different product prices on each website. Fine, product price scope set to 'Website'.

The problem is, can we use just one domain to service all of this? How will this work on the front end? Will Magento work nicely out of the box with this set up?

Thanks


texts: How to find the product url in Magento Database

texts: How to find Product URL in Magento database and how assign given URL for add to cart. please guide me.


texts: How to Add and Remove Footer Links in Magento 2

texts:
I have created a custom module and then created default.xml in app/code/Test/Mymodule/view/frontend/layout:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
     <referenceBlock name="privacy-policy-link" remove="true">
     <referenceBlock name="footer_links">
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-link">
             <arguments>
                 <argument name="label" xsi:type="string">Footer Link</argument>
                 <argument name="path" xsi:type="string">testuser</argument>
             </arguments>
         </block>
     </referenceBlock>
</body>
</page>

But its not showing the result.


texts: How to add Product name in magento 2.2.0

texts:
Hi guys I am trying to add columns of product name in admin order grid.

in "maggi\vendor\magento\module-sales\Block\Adminhtml\Transactions\Detail"

I override this function

 _prepareCollection(){
       $collection = Mage::getResourceModel($this->_getCollectionClass())
     ->join(
        'sales/order_item',
        '`sales/order_item`.order_id=`main_table`.entity_id',
        array(
            'skus'  => new Zend_Db_Expr('group_concat(`sales/order_item`.sku SEPARATOR ",")'),
            'names' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR ",")'),
        )
    );
     $collection->getSelect()->group('entity_id');

     $this->setCollection($collection);
     return parent::_prepareCollection();
}

and add column in this function

_prepareColumns(){
       $this->addColumn('names', array(
            'header'    => Mage::helper('Sales')->__('Name'),
            'width'     => '100px',
            'index'     => 'names',
            'type'        => 'text',
        ));
}

But nothing seems on order grid like name product name nothing.
What can I do ?


texts: magento 2.2 add validation to checkout region input field

texts:
following this post (Magento 2.2 Input field validation on Checkout page)

I can successfully add validation on the company field. But when I apply that to the region field, it doesn't work anymore. By "doesnt work" I mean that I get no validation message at all, I can write whatever I want in the region field and I get no red message.

What I need is to validate the region field so that the user can write only 2 characters. How can I do that?

  What I did:

1. created checkout_index_index.xml in my theme under app/design/frontend/Theme/default/Magento_Checkout/layout
2. Add the code specified in the post mentioned above
3. substitute "company" with "region"

Final xml:

<?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
    <referenceBlock  name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="shipping-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="shippingAddress" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <!-- To affect the shipping address fields -->
                                                    <item name="shipping-address-fieldset" xsi:type="array">
                                                        <item name="children" xsi:type="array">

                                                            <item name="region" xsi:type="array">
                                                                    <item name="validation" xsi:type="array">
                                                                        <item name="min_text_length" xsi:type="number">0</item>
                                                                        <item name="max_text_length" xsi:type="number">9</item>
                                                                        <item name="letters-only" xsi:type="boolean">true</item>
                                                                        <item name="required-entry" xsi:type="boolean">true</item>
                                                                        <item name="max-words" xsi:type="number">2</item>
                                                                    </item>
                                                                </item>

                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</body>

As I said, If I change "region" with "company", it works perfectly. But I need to apply the validation to the region field. Any idea how to achieve this?

Thanks


texts: Magento2: Bundle Product add to cart without selecting options (Product Item)

texts:
I am working on cms page custom product layout for that I have written custom controller. but it show error

{"0":"Please select all required options.","1":"#1
Magento\Checkout\Model\Cart\Interceptor->addProduct() called at
[app/code/Vendor/SmallBusiness/Controller/Index/AddCart.php:73]\n#2
Vendor\SmallBusiness\Controller\Index\AddCart->execute()
called at
[generated/code/Vendor/SmallBusiness/Controller/Index/AddCart/Interceptor.php:24]\n#3

Below is my controller
namespace Vendor\SmallBusiness\Controller\Index;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Data\Form\FormKey;
use Magento\Checkout\Model\Cart;
use Magento\Catalog\Model\ProductRepository;

class AddCart extends Action
{
    protected $formKey;
    protected $cart;
    protected $productRepository;

    public function __construct(
        Context $context,
        FormKey $formKey,
        Cart $cart,
        ProductRepository $productRepository) {
            $this->formKey = $formKey;
            $this->cart = $cart;
            $this->_productRepository = $productRepository;
            parent::__construct($context);
    }
    public function execute()
     {
        $id = $this->getRequest()->getParam('product_id');
        $quote = $this->cart;
        $_product = $this->_productRepository->getById($id);

        $selectionCollection = $_product->getTypeInstance(true)
                           ->getSelectionsCollection(
        $_product->getTypeInstance(true)->getOptionsIds($_product),$_product);

         // create bundle option
        $cont = 0;
        $selectionArray = [];
        $selectionqtyArray = [];
        $selectionpriceArray = [];

        foreach($selectionCollection as $proselection){
            $selectionArray[$cont] = $proselection->getSelectionId();
            $selectionqtyArray[$cont] = $proselection->getSelectionQty();
            $selectionpriceArray[$cont] = $proselection->getPrice();
            $cont++;
        }

        // get options ids
        $optionsCollection = $_product->getTypeInstance(true)->getOptionsCollection($_product);

        foreach ($optionsCollection as $options) {
           $id_option = $options->getId();
        }

        // generate bundle_option array
        $bundle_option = [$id_option => $selectionArray];
        $bundle_qty = [$id_option => $selectionqtyArray];
        $bundle_price = [$id_option => $selectionpriceArray];

        $params = [
                    'product' => $_product->getId(),
                    'bundle_option' => $bundle_option,
                    'bundle_option_qty' => $bundle_qty,
                    'bundle_option_price' => $bundle_price,
                    'qty' => 1,
                    'original_qty' => 1
                  ];

        $quote->addProduct($_product, $params);
        $quote->save();

     }
}


texts: Default values are not rendering on Wishlist product edit page

texts:
Default values are not rendering on wishlist product edit page

Steps to generate the issue:

Navigate to any configurable product page on the frontend.
Select the dropdown options and add the product to wishlist.
Navigate to My Wishlist page.
Click on Edit link given in wishlist item.

Expected Result:

It should auto-select the dropdown options on wishlist product edit page.

Actual Result:

It doesn't auto-select the dropdown options.

  Additional note: When I flush the cache and then click on Edit link,
  it auto-select the options.

I have checked it in Magento 2.2.2 and 2.2.4


texts:
Today i have created Magento2 REST API, it's working. similarly how to create soap api in magento2?.

app/etc/config.php

'modules' =>
  array (
    'Learning_CalculatorWebService' => 1,
  ),

app/code/Learning/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Learning_CalculatorWebService" schema_version="2.0.0"/>
</config>

app/code/Learning\CalculatorWebService\Api

<?php

namespace Learning\CalculatorWebService\Api;

interface CalculatorInterface
{
    public function add($num1, $num2);
}

app/code/Learning/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference for="Learning\CalculatorWebService\Api\CalculatorInterface" type="Learning\CalculatorWebService\Model\Calculator" />
</config>

app/code/Learning/etc/webapi.xml

<?xml version="1.0"?>

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">

    <route url="/V1/calculator/add/:num1/:num2" method="GET">
        <service class="Learning\CalculatorWebService\Api\CalculatorInterface" method="add"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>

</routes>

app/code/Learning\CalculatorWebService\Model

<?php
namespace Learning\CalculatorWebService\Model;
use Learning\CalculatorWebService\Api\CalculatorInterface;

class Calculator implements CalculatorInterface
{
    public function add($num1, $num2) {
        return $num1 + $num2;
    }

}

And i have entered url http://192.168.0.52/magento-2/index.php/rest/V1/calculator/add/1/2

it's returning 3 working fine.

Similarly how to create Magento2 SOAP API?

Thanks.


texts: Why multiple core_email_queue_send_all created in cron_schedule?

texts:
Trying to figure out how Magento crons are picking the schedules.  Read the magento document page and still not satisfied and thought of asking the question here.

I setup the cron as below

Generate Schedules Every : 15
Schedule Ahead for : 20

The cron.php is running for every 10 minutes.  The core frequency for email queue is every 1 minute and I havent override that.

When the cron runs, it created too many schedules for core_email_queue_send_all.

Whant to understand why?  What is the logic?