texts: Pull recent records from collection with group clause

texts:
I am pulling records from sales_flat_quote using collection and to make the records unique i have applied customer_email group clause on collection. Below is the code.

$collection = Mage::getResourceModel('sales/quote_collection')
        ->addFieldToFilter('is_active', '1')
        ->addFieldToFilter('customer_email', array('notnull' => true));

$collection->getSelect()->group('customer_email');

here the problem is by using group, latest records are getting filter instead i want the older records to get filtered. guys please provide your valuable input on these question.

EDIT [Explanation]

lets say i am getting below records in collection and lets assume email address's column name is email

1. abc@abc.com
2. foo@bar.com
3. xyz@xyz.com
4. foo@bar.com

here when i do $collection->getSelect()->group('email'); i will get filtered records as below

1. abc@abc.com
2. foo@bar.com
3. xyz@xyz.com

instead of that i want

1. abc@abc.com
3. xyz@xyz.com
4. foo@bar.com


texts: Magento 2: Change quote from current quote to other quote id

texts: Please let me know how can I change my current quote to any other quote saved in database using an event observer in magento 2.2


texts: Magento CSS and JavaScript not loading due to using file system path

texts:
I was unable to install a module using Magento Connect, getting a Connection Error try again later error. Following the instructions of the module developer I attempted to fix permissions in the document root with:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media

It still didn't work so I ended up installing the module manually. I then logged into the admin backend and Magento was trying serve CSS files using the system file paths instead of URLs like so:

<link rel="stylesheet" type="text/css" href="/home/user/public_html/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/reset.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/custom.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/xmlconnect/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/menu.css" media="screen, projection" />

I immediately removed the extension and tried to match the perms from another server with a working Magento to no avail. I have also:

Cleared local, APC, and Magento caches
Looked in error logs (logging is enabled)
double-checked proper values of web/unsecure/base_url and web/secure/base_url in the DB
Rebooted, 3 times ;)

Minify is not being used. Merge CSS files are enabled, however I cannot figure out how to disable without the admin interface (save and navigation isn't working, even when I replace the correct values with Firebug). Any ideas would be greatly appreciated!

(Question originally posted by @reflexiv on Stack Overflow)


texts: How to move cms static block widget in Magento 2.1

texts:
I created a CMS static block called social_media_block through the admin site then created a widget with that block and place it in the page footer.  It shows up as the last block in the footer and I would like it to be placed after the newsletter block and before the footer links.  I tried the to move the block with

<move element="social_media_block" destination="footer" after="form.subscribe"/>

in app/design/frontend/my/theme/Magento_Theme/layout/default.xml but not moving.  Can CMS static block widgets be moved or do I need to create it another way?

Edit:
I tried adding this but got an Invalid block type: Magento\Cms\Block\Widget\Block Exception

<block class="Magento\Cms\Block\Widget\Block " name="social_media_block" before="footer_links"/>


texts:
I've recently noticed the following message in the Magento backend:
"Your current version of cURL php5 module is 7.19.7, which can prevent services that require TLS v1.2 from working correctly. It is recommended to update your cURL php5 module to version 7.34.0 or higher."

What does this mean, and how do do I update my cURL php5 module?


texts: Magento 2: No data migration tool matching version

texts:
My Magento version is 2.2.9.
No matching data migration tool exists.

What should I do?

Should I install Magento version 2.2.7?


texts:
I am trying to override Model file in my custom module like below.

Vendor/Module/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="Magento\InventorySales\Model\IsProductSalableCondition\BackOrderNotifyCustomerCondition" type="Vendor\Module\Model\IsProductSalableCondition\BackOrderNotifyCustomerCondition" />

</config>

Then Vendor\Module\Model\IsProductSalableCondition\BackOrderNotifyCustomerCondition

<?php

  declare(strict_types=1);

 namespace Vendor\Module\Model\IsProductSalableCondition;

 use Magento\InventoryConfigurationApi\Api\Data\StockItemConfigurationInterface;
use Magento\InventoryConfigurationApi\Api\GetStockItemConfigurationInterface;
use Magento\InventorySalesApi\Api\Data\ProductSalabilityErrorInterfaceFactory;
use Magento\InventorySalesApi\Api\Data\ProductSalableResultInterface;
use Magento\InventorySalesApi\Api\Data\ProductSalableResultInterfaceFactory;
use Magento\InventorySalesApi\Api\IsProductSalableForRequestedQtyInterface;
use Magento\InventorySalesApi\Model\GetStockItemDataInterface;

/**
 * @inheritdoc
 */

class BackOrderNotifyCustomerCondition implements
 IsProductSalableForRequestedQtyInterface
{
/**
 * @var GetStockItemConfigurationInterface
 */
private $getStockItemConfiguration;

/**
 * @var GetStockItemDataInterface
 */
private $getStockItemData;

/**
 * @var ProductSalableResultInterfaceFactory
 */
private $productSalableResultFactory;

/**
 * @var ProductSalabilityErrorInterfaceFactory
 */
private $productSalabilityErrorFactory;

/**
 * @param GetStockItemConfigurationInterface $getStockItemConfiguration
 * @param GetStockItemDataInterface $getStockItemData
 * @param ProductSalableResultInterfaceFactory $productSalableResultFactory
 * @param ProductSalabilityErrorInterfaceFactory $productSalabilityErrorFactory
 */
public function __construct(
    GetStockItemConfigurationInterface $getStockItemConfiguration,
    GetStockItemDataInterface $getStockItemData,
    ProductSalableResultInterfaceFactory $productSalableResultFactory,
    ProductSalabilityErrorInterfaceFactory $productSalabilityErrorFactory
) {
    $this->getStockItemConfiguration = $getStockItemConfiguration;
    $this->getStockItemData = $getStockItemData;
    $this->productSalableResultFactory = $productSalableResultFactory;
    $this->productSalabilityErrorFactory = $productSalabilityErrorFactory;
}

/**
 * @inheritdoc
 */
public function execute(string $sku, int $stockId, float $requestedQty): ProductSalableResultInterface
{
    $stockItemConfiguration = $this->getStockItemConfiguration->execute($sku, $stockId);

    if ($stockItemConfiguration->getBackorders() === StockItemConfigurationInterface::BACKORDERS_YES_NOTIFY) {
        $stockItemData = $this->getStockItemData->execute($sku, $stockId);
        if (null === $stockItemData) {
            return $this->productSalableResultFactory->create(['errors' => []]);
        }

        $backOrderQty = $requestedQty - $stockItemData[GetStockItemDataInterface::QUANTITY];
        if ($backOrderQty > 0) {
            $errors = [
                $this->productSalabilityErrorFactory->create([
                        'code' => 'back_order-not-enough',
                        'message' => __(
                            'We don\'t have as many quantity as you requested, '
                            . 'but we\'ll back order the remaining %1.',
                            $backOrderQty * 1
                        )])
            ];
            return $this->productSalableResultFactory->create(['errors' => $errors]);
        }
    }

    return $this->productSalableResultFactory->create(['errors' => []]);
  }
}

Which is not overriding to my custom module, can anyone tell where exactly the issue is? Suggest me if any other possibilities using plugin or something.

Thanks


texts: Create custom options on create product with custom product type

texts:
I have created a new product by extending \Magento\Catalog\Model\Product\Type\Virtual.

How to add custom options programmatically, every time I create a product of this type?

doing this in my product type class not working

/**
 * Before save type related data
 *
 * @param \Magento\Catalog\Model\Product $product
 * @return $this
 */
public function beforeSave($product)
{
    parent::beforeSave($product);

    $options[] = array(
        "sort_order"    => 1,
        "title"         => "Select Date",
        "type"          => "date",
        "is_require"    => 1,
        "price_type"    => "fixed"
    );
    $product->unsetOptions();
    $product->setHasOptions(1);
    $product->setCanSaveCustomOptions(true);
    $product->getResource()->save($product);
    $product->setOptions(array());
    foreach ($options as $arrayOption) {
        $option = $this->_objectManager->create('\Magento\Catalog\Model\Product\Option')
            ->setProductId($product->getId())
            ->setStoreId($product->getStoreId())
            ->addData($arrayOption);
        $option->save();
        $options[] = $option;
        $product->addOption($option);
    }

    return $this;
}


texts: How to add block near a product image in a product detail page in Magento 2


texts:
Magento 1.9.3.1 - Catalog URL Rewrites - Index Management - Stuck in Processing.

I have had this happen in the past on earlier versions of Magento and I have been able to get one of the fixes already online to work (replace app/code/core/Mage/Catalog/Model/URL.php in Local with patch / code fixes) - I also have the Index Optimization module installed.

Nothing is fixing it this time. I am on a shared server with limited direct server shell access. Also - there is no file in the var/locks folder.

Any and all help/suggestions would be appreciated.


texts: Category url appending -1 out of the blue

texts:
As I know it, magento only ads a -1 when creating or editing a url that already exists, in order to not have duplicate urls.

But this time magento ads a -1 to categories out of the blue, without editing the categories. For example yesterday I checked all my categories in the menu, and none of them had links with -1, but today some of them have -1 in urls when checking the menu.

Why would this happen?


texts: Get order item collection from payment magento 2

texts:
How to get itemCollection from Payment ?

I get getOrder() on null for the below code

$payment = $observer->getEvent()->getPayment();
$items = $payment->getOrder()->getItemsCollection();


texts: How to get all image urls in product collection? How to apply group_concat here?

texts:
I'm trying to get product collection with all of its images url. Is there any other way to get product collection with all of it image urls?

$collection = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect('*')
        ->joinField(
            'qty',
            'cataloginventory/stock_item',
            'qty',
            'product_id=entity_id',
            '{{table}}.stock_id=1',
            'left')
        ->joinField(
            'imgurls',
            'catalog/product_attribute_media_gallery',
            'value',
            'entity_id = entity_id',
            null,
            'left')
        ->groupByAttribute('entity_id')
        ->addAttributeToSort('updated_at','asc')
        ->addAttributeToFilter('updated_at', array('from' => $updateAtFilter))
        ->setPageSize($transferLimit)
;


texts:
like this

<block class="Magefan\Blog\Block\Post\PostList\Item" name="blog.posts.list.item" template="post/list/item.phtml">
      <block class="Magefan\Blog\Block\Post\Info" name="blog.post.info" template="post/info.phtml" />
         <action method="setPostInfoBlockName">
                    <argument name="name" xsi:type="string">blog.post.info</argument>
         </action>
</block>


texts: If the invoice was created offline, try creating an offline credit memo. Magento2.3.4

texts:
Getting error when try to create online refund.

If the invoice was created offline, try creating an offline credit memo.


texts:
Have hunted round for this but can't find an answer.
As the title suggests I want to add a custom attribute to a container.

I currently have a container in layout.xml as such;

<container name="my.custom.container" as="my_custom_container" htmlTag="div" htmlClass="myCustomContainer" htmlId="customContainer">

which generates

as expected.

How do I add a custom attribute to this?
E.g. (As to to end up with)

Thanks


texts: Can't access images on pub/media magento 2

texts:
I created sign up with avatar module and it throws the customer avatars in
pub/media/customer as an example:

  http//:www.domain.com/pub/media/customer/u/n/undefined.png

But in the mobile app, when I call this link to display the avatar, I always get 404 page.

I checked the customer folder and found .htaccess the file which denies accessing all files under this folder. I removed it but still get 404 page.

What is wrong?


texts: getSummaryCount() and getItemsCount() returns the same value

texts: I am trying to get the item quantity in the cart. For that I am using:Mage::helper('checkout/cart')->getItemsCount()andMage::helper('checkout/cart')->getSummaryCount() getSummaryCount() is what I really need, but it always returns the same value as getItemsCount(). For example: If I would have two of the same item in my basket, both functions would return 1. (I want it to return 2)   Why could this be happening?


texts: Database connection parameters via environmental variables

texts:
Currently working on the deployment of a Magento 2.2.x instance and I can't seem to find any documentation regarding the ability to set the database connection parameters as environmental variables.

I have looked at the documentation on how to Use environment variables to override configuration settings but can't seem to find anything related to this.

Anyone knows if this is possible with a default Magento 2.2.x instance? If so, what are the environmental variables keys that I can use?

Thanks!

Edit: Found a way of doing this thanks to the accepted answer below. Part of app/etc/env.php:

...
array (
    'host' => !empty($_SERVER['CONFIG_DB_HOST']) ? $_SERVER['CONFIG_DB_HOST'] : '',
    'dbname' => !empty($_SERVER['CONFIG_DB_DBNAME']) ? $_SERVER['CONFIG_DB_DBNAME'] : '',
    'username' => !empty($_SERVER['CONFIG_DB_USERNAME']) ? $_SERVER['CONFIG_DB_USERNAME'] : '',
    'password' => !empty($_SERVER['CONFIG_DB_PASSWORD']) ? $_SERVER['CONFIG_DB_PASSWORD'] : '',
    'active' => '1',
  ),
...


texts: Magento 2 how to make order comments as required field

texts: How to make order comments as required field and need to move before payment option?


texts: Magento Create attribute with Data type Varchar(100)

texts:
I have created a customer attribute using installer script. Attribute gets created but what I want is by default magento is setting varchar(255) but I want the varchar(100)

I have used below code:

$attribute = array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'Company name',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 0,
    'position' => 132

);
$installer->addAttribute('customer', 'company_name', $attribute);
Mage::getSingleton('eav/config')
        ->getAttribute('customer', 'company_name')
        ->setData('used_in_forms', array('adminhtml_customer'))
        ->save();

Can anyone suggest, how to achieve this?


texts: Add 'Review this product' in the Product listing Page (catalogue grid view page)

texts:
I am using Magento 2.3.2 with custom theme. I want to add 'Review this product' in the Product listing view when there are no reviews. In the file

  app/design/frontend/(vendor)/(theme-name)/Magento_Catalog/templates/product/list.phtml

I have tried adding this:

<?php if( count( $this->getReviewsCollection() ) > 0  ): ?>
<?= $block->getReviewsSummaryHtml($_product, $templateType) ?>
<?php else: ?>

<a href="<?= /* @escapeNotVerified */ $_product->getProductUrl() ?>" class="product-review">Review this product

<?php endif; ?>

But I get this error:this returns:

  Exception #0 (Exception): Warning: count(): Parameter must be an array or an object that implements Countable in /home/iperqer/public_html/app/design/frontend/iperQ/market/Magento_Catalog/templates/product/list.phtml on line 72 plus a bunch of other code.

Any Ideas about how to achieve this.


texts: Hide php code for certain customer groups

texts:
How can I hide the php code below from certain customer group ids 5,6,7? My code below of what I have thus far.

<?php
    $isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
if($isLoggedIn):
        $customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    if(in_array($customerGroupId, array('5','6','7'))):

                <?php  if($quotedFeeType == 'fob' && $code != "flatrate") continue; ?>
                <?php  if(($quotedFeeType == 'ddp' || $quotedFeeType == 'cif') && $code != "tablerate") continue; ?>
        endif;
 endif;
?>

Thank you


texts: How to send email after order success not order be created?

texts:
I'm developing a custom payment method for bank . I want to send order email after customer paid,but email always be sent after checkout page chouse payment method and click next button.
I think first answer is for my question ,but code is not working.Email still send while order created.
Anyone can help me change email when to send?


texts: How to remove Warning: DOMDocument::schemaValidate(): Invalid Schema

texts:
When I run my  magento 2.3.1 ver. on localhost in morning then comes below error

Warning: DOMDocument::schemaValidate(): Invalid Schema

So please let me help.


texts: Get at a categories image in PHP | Magento2

texts:
I am trying to get at a categories image from within PHP / a .phtml file.

Here is my code:

$_category  = $this->getCurrentCategory();
$_children  = $_category->getChildrenCategories();
foreach( $_children as $child ){
    if( $child->getIsActive() ){
        echo "<p>" . $child->getImageUrl() . "</p>";

This last line results in an empty string. When I var_dump it, I get the following:

bool(false)

Upon further investigation, this getImageUrl function is defined in /vendor/magento/module-catalog/Model/Category.php on line 656, like so:

public function getImageUrl(){
    $url = false;
    $image = $this->getImage();
    if ($image) {

The problem here is that $this->getImage() returns NULL. Nowhere in Category.php can I find the function getImage, and all of this makes me think that there is no getImage function in the Category class.

Is this correct? Do we need to add a getImage method to the class to make getImageUrl work?

Or is getImage inherited from elsewhere? And in this case, why is it returning NULL?

Disclaimers:

This is Magento 2.0.2.

I am not about to alter core code, I already have a theme of my own, and if I was to add a new function to the Category class I would extend the core code in my theme.

I have re-indexed, I have cleared caches, I have re-deployed.


texts:
Wanting to add mm for dimensions (width, depth, height) and cubic meter.
Additionally would like to have dimensions as a slider that can be filtered on in Layered Navigation.


texts: What does "_current_limit" or "_current_grid_direction" do?

texts:
I'm in app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php and I see lines like the following:

$dir = $this->_getData('_current_grid_direction');

$limit = $this->_getData('_current_limit');

Yet when I search the app, I don't see mention of these values anywhere else.  Where are these attributes used?  Why does nothing else set them?  How can I know what other attributes might exist for a collection?  How can I know what values are accepted for them?


texts: how to delete flat table custom model object with foreign key?

texts:
Created flat table model that have foreign dependency for customer_entity.customer_id column, and for some unknown reason I am unable to delete object that I have successfull created before:

                 $required_model = Mage::getModel('Mymodule/Payments')
                    ->getCollection()
                    ->addFieldToSelect('customer_id')
                    ->addFieldToSelect('email')
                    ->addFieldToFilter('customer_id', $session->getCustomer()->getId())
                    ->getItems();

                if(is_array($required_model) && (count($required_model) > 0)) {

                    try {

                        reset($required_model);
                        Mage::app();
                        Mage::app('admin');
                        Mage::setIsDeveloperMode(true);
                        $model = $required_model[key($required_model)];
                        $model->delete();
                        var_dump($model); // object does not delete from table, and succesfully var_dumps here
                       }
                       ...

var_dump succesfully dumps the object:

                    object(Mycomp_Mymodule_Model_Payments)[175]
                      protected '_eventPrefix' => string 'core_abstract' (length=13)
                      protected '_eventObject' => string 'object' (length=6)
                      protected '_resourceName' => string 'Mymodule/payments' (length=12)
                      protected '_resource' => null
                      protected '_resourceCollectionName' => string 'Mymodule/payments_collection' (length=23)
                      protected '_cacheTag' => boolean false
                      protected '_dataSaveAllowed' => boolean true
                      protected '_isObjectNew' => null
                      protected '_data' =>
                        array (size=2)
                          'customer_id' => string '215' (length=3)
                            ...

my module config.xml:

            <mymodule_resource>
                <class>Mycomp_Mymodule_Model_Resource</class>
                <entities>
                    ...
                    <payments>

mymodule_customer_payments_info

                    </payments>
                 </entities>
                    ...
            </mymodule_resource>

resource, collection and model files are set and initialized in constructor

where to dig ?
thanks!

ps:

teble skeleton is like this:

    try {
        $sql = "
          CREATE TABLE `{$this->getTable('Mymodule/payments')}` (
            `entity_id` int(10) unsigned NOT NULL auto_increment,
            `country` text NOT NULL,
            `email` text NULL,
            `vat` text NULL,
            `customer_id` int(10) unsigned,
            `type` int(10) unsigned,
            `created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
            PRIMARY KEY (`entity_id`),
            CONSTRAINT `FK_mymodule_customer_payments_info_customer_id` FOREIGN KEY (`customer_id`) REFERENCES {$this->getTable('customer_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE)
          ENGINE = InnoDB;";
        $this->run($sql);
    }


texts: Is there anyway to move the cart products list to the checkout steps

texts:
I'm trying to add a custom checkout step called Gifts and Rewards, where I can list the products and show the option of wrapping the gifts (available already in the cart in commerce version).

so basically this step shows the list of products typically like in the cart.

any recommendations?


texts: How can we add header and footer to invoice pdf

texts:
I am trying to add header to the invoice pdf.

I need to include header and footer to the invoice pdf which downloaded from magento2 admin sales order grid. How can we do that. Someone please help me.


texts: Magento 2: How to set visitor_data and currency_code session value?

texts:
In magento 2, For check all current session in magento 2, when we print print_r($_SESSION) then some list of session are display inside browser.

Resultant session look like below,

Array
(
    [_session_validator_data] => Array
        (
            [remote_addr] => 127.0.0.1
            [http_via] =>
            [http_x_forwarded_for] =>
            [http_user_agent] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.82 Chrome/48.0.2564.82 Safari/537.36
        )

    [_session_hosts] => Array
        (
            [141.0.165.165] => 1
        )

    [default] => Array
        (
            [visitor_data] => Array
                (
                    [last_visit_at] => 2016-07-29 14:04:30
                    [session_id] => lc7db6me3qgvm0srirje5pj6c6
                    [visitor_id] => 5530
                )

            [_form_key] => R45hajbDrwRyg2MW
            [currency_code] => GBP
        )

    [customer_base] => Array
        (
        )

    [catalog] => Array
        (
            [last_visited_category_id] => 15
            [last_viewed_category_id] => 15
        )

    [adminhtml] => Array
        (
        )

    [checkout] => Array
        (
        )

    [message] => Array
        (
            [default] => Magento\Framework\Message\Collection Object
                (
                    [messages:protected] => Array
                        (
                        )

                    [lastAddedMessage:protected] =>
                )

        )

    [admin] => Array
        (
        )

)

I want to know how to set default session in magento? at which place currency_code and visitor_data session value are saved?

How can we set session inside default in above code?
Any idea would be appericiated.

Thanks.


texts: Does a ChronoPay extension exist for Magento 1?

texts:
Reading some official document it appears that Magento supports ChronoPay payment gateway, but there is no evidence in source code or backend of Magento 1 CE.

Magento Connect and Google aren't helping either.

The only pseudo-extension I found is something embedded in a custom Magento Russian Edition that is sold under a proprietary license.

Is it just a matter of outdated/wrong documentation?


texts: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect) magento rest api error

texts:
Error message below

  Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a
  redirect)
  {"messages":{"error":[{"code":401,"message":"oauth_problem=internal_error&message=Mage
  registry key \"_singleton/admin/session\" already exists"}]}}

This error showing when I try to get all products via Rest api in magento 1.9.3.4.

Below is the code

$callbackUrl = "magentohost/test.php";
$temporaryCredentialsRequestUrl = "magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$customerAuthorizationUrl = 'magentohost/oauth/authorize';
$accessTokenRequestUrl = 'magentohost/oauth/token';
$apiUrl = 'magentohost/api/rest';
$consumerKey = 'xxxxxxxxxxxxxxxxxxxx';
$consumerSecret = 'xxxxxxxxxxxxxxxxxx';

session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
    $_SESSION['state'] = 0;
}
try {
    $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
    $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
    $oauthClient->enableDebug();

    if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
        $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
        $_SESSION['secret'] = $requestToken['oauth_token_secret'];
        $_SESSION['state'] = 1;
        header('Location: ' . $customerAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
        exit;
    } else if ($_SESSION['state'] == 1) {
        $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
        $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
        $_SESSION['state'] = 2;
        $_SESSION['token'] = $accessToken['oauth_token'];
        $_SESSION['secret'] = $accessToken['oauth_token_secret'];
        header('Location: ' . $callbackUrl);
        exit;
    } else {
        $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);

        $resourceUrl = "$apiUrl/products";
        $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => 'application/json'));
        $productsList = json_decode($oauthClient->getLastResponse());
        print_r($productsList);
    }
} catch (OAuthException $e) {
    print_r($e->getMessage());
    echo "<br/>";
    print_r($e->lastResponse);
}

Please help me to resolved this issue. Thanks in advance.


texts: Base currency is CAD, but need to see USD prices in Magento Admin

texts:
My base prices are in CAD (Canadian Dollars), I am trying to create an attribute which will show converted USD prices in the Backend. It must be an attribute, because I will need that converted USD price attribute to create Google Feeds.

So far, converted USD prices are only visible on the Fronend.

Please help guys! I would very much appreciate it.

Thank you in advance!


texts: Magento Exclude SKU from Minimum Order Amount

texts:
Currently have a Magento site using the standard minimum order amount functionality in System > Config > Sales > Minimum order amount.

Minimum order amount is set to £30.

I would like to allow certain SKU's through this rule, I have read a post on this and currently have the following setup but unable to get this working:

Original File location: /public_html/app/code/core/Mage/Sales/Model/Quote

Edited file location: /public_html/app/code/local/Mage/Sales/Model/Quote

Filename: Address.php

I have replaced the following:

        $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
    if ($this->getBaseSubtotalWithDiscount() < $amount) {
        return false;
    }
    return true;
}

With:

 $amount = Mage::getStoreConfig('sales/minimum_order/amount', $storeId);
foreach($this->getAllItems() as $item){
    if(in_array($item->getSku(), array("MELT04", "HRT02")))
    $amount += $item->getPrice();
}
   if ($this->getBaseSubtotalWithDiscount() < $amount) {
    return false;
}

    return true;
}

But this does not allow the following SKU's through MELT04 & HRT02.

Please help, thanks in advance.


texts: magento admin :reset password email via php code

texts:
I earlier posted question to get customer rest password via code and below code works fine:

$email='abc@gmail.com';

$customer = Mage::getModel('customer/customer')
                ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
                ->loadByEmail($email);
$customer->sendPasswordResetConfirmationEmail();

But what if want to reset password of one of admins , how can I use above code to work ?


texts:
I have create a module that have a block file, a controller and a template to show
"WHAT OTHER CUSTOMERS ARE LOOKING AT RIGHT NOW" on home page
The controller render the template and show the output (controller called via ajax)
The issue is the content of the template update every time a new product is viewed,So I don't want the output to be cached, how can I stop caching of controller output
Currently I am using Magento's Full page cache and I will be using Varnish On Production
Updated
Block
<?php
namespace Vendor\Catalog\Block\Product\Suggestion;

class RightNowCollection extends \Magento\Framework\View\Element\Template
{
     protected $_categoryHelper;
     protected $categoryFlatConfig;
     protected $_registry;
     protected $_categoryFactory;
    /**
     * @param \Magento\Framework\View\Element\Template\Context $context
     * @param \Magento\Catalog\Helper\Category $categoryHelper
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Catalog\Helper\Category $categoryHelper,
        \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState
    ) {
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $this->_registry = $objectManager->get('Magento\Framework\Registry');
        $this->_categoryFactory = $objectManager->get('\Magento\Catalog\Model\CategoryFactory');

        $this->_categoryHelper = $categoryHelper;
        $this->categoryFlatConfig = $categoryFlatState;

        parent::__construct($context);

        $this->addData(array('cache_lifetime' => false));
    }

    public function getSomeThing()
    {
        return 'Something';
    }

}

Controller
<?php
namespace Vendor\Catalog\Controller\Catalog;

use Magento\Framework\App\Action\Context;
use Magento\Framework\UrlInterface;
use Magento\Catalog\Model\ProductFactory;
use \Magento\Catalog\Block\Product\ListProduct;
use Magento\Framework\View\Result\PageFactory;

class RightNow extends \Magento\Framework\App\Action\Action
{
    protected $_listProduct;
    protected $_productFactory;
    protected $_resultPageFactory;

    public function __construct(
        Context $context,
        UrlInterface $urlBuilder,
        ProductFactory $productFactory,
        ListProduct $listProd,
        PageFactory $resultPageFactory
    ) {
        parent::__construct($context);
        $this->urlBuilder = $urlBuilder;
        $this->_productFactory = $productFactory;
        $this->_listProduct = $listProd;
        $this->_resultPageFactory = $resultPageFactory;
    }

    public function execute() {
        $resultPage = $this->_resultPageFactory->create();
        $resultPage->getConfig()->getTitle()->prepend(__(' heading '));

        $block = $resultPage->getLayout()
                ->createBlock('Vendor\Catalog\Block\Product\Suggestion\RightNowCollection')
                ->setTemplate('Vendor_Catalog::one.phtml')
                ->toHtml();
        $this->getResponse()->setBody($block);
    }
}


texts: How do I not repeat code while not being able to extend multiple blocks?

texts:
I've created a new custom module to store manufacturers, which links to products via a custom attribute on products.

There are 2 places I want to use the manufacturer details. One is on the product page; the other is on a separate manufacturer page.

My question is how to structure the blocks in terms of inheritance. Both blocks use some of the same methods (getManufacturer(), getManufacturerName(), etc.), so being a good programmer and not wanting to repeat myself I thought of creating some kind of base class which these could both inherit from.

However, the block on the product page uses the product view block's getProduct() method, which is very useful and again I wouldn't want to repeat this code.

Another option would be to have the product page block inherit from product view, and the manufacturer page block(s) inherit from this afore-mentioned block - but this doesn't seem particularly logical to me.

Obviously I can't extend from both blocks. What is the best way to structure this so that I'm not repeating code unnecessarily and structuring things in a logical way?


texts: How to run Controller function using SSH

texts:
I have function massProductcreateAction() At

  app\code\local\Adit\Rapnet\controllers\Adminhtml\RapnetController.php

This function creates product from database and after creating 30 product to Magento, script will be time out.(500: Internal Error)

So is there a way to continuously run this function and I can create 10000 item at a single time. Using SSH or cron?


texts: Can i save every order placed with custom payment method to order status complete?

texts:
I have integrated Custom payment module. I want to save every order placed with custom payment selected should be set to complete.

( If the selected payment mode is with MYPay ) Order Status -> complete

I have tried like this
vendor_name\module_name\etc\di.xml

di.xml file

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Checkout\Model\DefaultConfigProvider" type="Iostpay\Iostpaymagento\Model\DefaultConfigProvider" />
     <type name="Magento\Sales\Api\OrderRepositoryInterface">
        <plugin name="order_state_plugin"
                type="Iostpay\Iostpaymagento\Model\Plugin\OrderStatePlugin"/>
    </type>
</config>

Plugin

vendor_name\module_name\Plugin\OrderStatePlugin.php

<?php

namespace vendor_name\module_name\Plugin;

class OrderStatePlugin
{
/**
 * @param \Magento\Sales\Api\OrderRepositoryInterface $subject
 * @param \Magento\Sales\Api\Data\OrderInterface $result
 * @return mixed
 * @throws \Exception
 */
public function afterSave(\Magento\Sales\Api\OrderRepositoryInterface $subject,$result)
 {
    if($result->getState() == Order::STATE_COMPLETE) {

    }
    return $result;

 }

But If this is the only way to do. what do I need to update in the plugin Code?

Does anyone know how to do this? Thanks in Advance.


texts: How to create company account when saving the form details?

texts:
I have created customer attributes and created a custom form with the customer attribute fields. Now I want to create a company account when customer fill the form details and save it.
But I don't know where to start. Can anyone please help me with this?
Thanks.


texts: How to implement my own action in custom admin grid?

texts:
I have custom admin grid which shows data from my table.
Last column in this table is "Actions".
And there are two actions (links) - "Approve" and "Reject".
My links looks like:

http://mgtraining.box/admin_18vp0y/grid/grid/approve/id/1/key/

http://mgtraining.box/admin_18vp0y/grid/grid/reject/id/1/key/

How to make custom actions for each link with redirect back to grid?

Thank you!


texts: How to set unique page in one specific store and leave the rest stores with default one?

texts:
I have 4 stores and I'd like to set unique page (lets say I'd want one page to be translated and the others not) to just and only one store. Other stores should have "default" page view.

I've tried to set All Store Views (in Content > Pages) on default one and then add another page with same URL Key but for only one store, but all I've got is error that URL Key already exists.

I'm using Magento 2.1.7


texts: Validation of review's textfield, nothing seems to works

texts:
I'm struggling to find what I'm doing wrong in this process, and I kindly ask for your suggestions.
The goal is : To have a minimum text for the products reviews.
In a previous question I received the suggestion to use jquery, but looking around seems that it could lead to some conflicts. so I prefer to use the Magento form validation, both for speed and compatibility.
What I've done:
Looking at the validation.js file I've foun that there is a validation that could do the trick.
using this :

['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) {
                var reMax = new RegExp(/^maximum-length-[0-9]+$/);
                var reMin = new RegExp(/^minimum-length-[0-9]+$/);
                var result = true;
                $w(elm.className).each(function(name, index) {
                    if (name.match(reMax) && result) {
                       var length = name.split('-')[2];
                       result = (v.length <= length);
                    }
                    if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) {
                        var length = name.split('-')[2];
                        result = (v.length >= length);
                    }
                });
                return result;
            }],

I modified the file "form.phtml" in

  app/design/frontend/default/MYTEMPLATE/template/review

adding the class after class="required-entry" , so basically , right now the review details text-area looks like:

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

    <textarea  name="detail" id="review_field" cols="5" rows="3" class="required-entry validate-length maximum-length-600 minimum-length-150"><?php echo $this->htmlEscape($data->getDetail()) ?></textarea>

What is happening is ....NOTHING.
just as if I didn't do any changes.
I also tried to add a custom class in the validation.js file , using this code:

['validate-revminlength', 'Minimum 150 characters are needed.', function (v, elm) {

if(v.length < 150)
{
return false;
}
else
{
return true;
}
}],

and then adding the class validate-revminlength just after required-entry.
No changes at all.
reviews are still sent even with 2 letters.
the strange behaviour is also that if I try to remove the class "required-entry" or if I add something different just like "test" it seems to still work as if nothing has changed.
What do I miss?
What should I check ?


texts: Update to 1.9.2.4 breaks custom Sales Order Grid mass Action

texts:
I have added a new mass action on the sales order grid. It worked flawlessly on all 1.9.x releases up to 1.9.2.4 upgrade from 1.9.2.2 so I suspect this is now broken by the new security features that require me to white list Variables and Blocks.

The following code adds and enables the mass action (order export to SCV).

/app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid.php
..

$this->getMassactionBlock()->addItem('export_selected', array(
             'label'=> Mage::helper('sales')->__('(new) Export to CSV'),
              'url'  =>$this->getUrl('*/*/massExport', array('_current'=>true)),
        ));

..

/app/code/local/Mage/Adminhtml/controllers/Sales/OrderController.php
..

public function massExportAction()
     {
         //$productIds = $this->getRequest()->getParam('product');
         $orderIds = $this->getRequest()->getParam('order_ids');
         if (!is_array($orderIds)) {
             $this->_getSession()->addError($this->__('Please select orders(s).'));
             $this->_redirect('*/*/index');
         }
         else {
             //write headers to the csv file
             $content = '"order_number","customer_name","customer_email"';
             try {
                 foreach ($orderIds as $orderId) {
                     $order = Mage::getSingleton('sales/order')->load($orderId);
                     $content .= "\"{$order->getIncrementId()}\",\"{$order->getCustomerName()}\",\"{$order->getCustomerEmail()}\"\r\n";
                 }
             } catch (Exception $e) {
                 $this->_getSession()->addError($e->getMessage());
                 $this->_redirect('*/*/');
             }
             $this->_prepareDownloadResponse('orders-export-'.date('Y-m-d H:i:s').'.csv', $content, 'text/csv');
         }

     }

..

As of 1.9.2.4 calling the function from the Sales Order Grid in the admin interface results in no file being created and 404 that points to frontend..

Any recommendations on what am I missing here?


texts: Custom text field for configurable product Magento 2

texts:
I am very new in Magento and from last few days I am trying to figure out how to add a Custom text field in the frontend for configurable product. I tried to do that but text-field text area is not showing up in the configurable product list of attributes. I can add drop down only.

I am looking for something that for example a customer want to buy a t-shirt and the text inside the t-shirt will be configurable from frontend product view page.

For example : custom text cost $5. There will be a checkbox in the product view page. When the customer click on it a text box will appear where he can add his text for the t-shirt. The $5 will automatically add with the checkout price.

I hope I am able to make you understand what I am trying to do. But, search a lot to figure it out but failed.

Thanks


texts: Magento2: How to set new session and clear session in login and logout

texts:
I want to add new session when user logged in also unset this session when user logged out.

When user logged in
set $this->customerSession->setRegisterEventId('1');
after user logged out
Unset $this->customerSession->unsRegisterEventId();


texts: Installing Magento 2 extension via composer.json file

texts: I bought an extension on Magento store.On my magento installation, I don't have web setup wizard and when I checked the solution for this it requires to change main config file which I don't have access at the moment.So then I downloaded the extension from Magento store, this time the downloaded zip contains only composer.json file. How can I install this extension via composer.json file ? Itried to install with composer require with only name of the extension I saw in the composer.json file, but it didn't work.I need to install this extension with composer.json file.Thanks in advance.


texts: Magento 2 Change base image when attribute is selected on catalog page

texts:
I want to change the base image depending on the color which is selected. So if i select "Olive Green", all the products with olive color single products must change the base images to the black version.

So, this is the standard catalog page:

I change the color with the color swatch:

If i change the color to Olive Green, i see this:

But i want to see this:

All the single products do have their own image. How to do this?


texts: Cant Perform action on product ,order etc grid

texts:
I have weird issue on magento I was tired alot to reolve it

Issue was: In admin section when I was trying to perform any action in the grid which is showing on right section of catelog,order etc  like this

When I am trying to perform delete action on any product and click on submit button nothing is happened can anybody suggest whats going on ?
How I can resolve it?
Please help :(
Also in log I found only 1 error

  2015-08-27T11:21:32+00:00 ERR (3): Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 16: parser error : Extra content at the end of the document  in /home/systema1/public_html/somethingaboutmommy/lib/Varien/Simplexml/Config.php on line 510

But I think This is not related with this issue.
Thanks in advance


texts: Magento 2 : How To Show Price of "out of stock" Products

texts:
I want to show the price of product, that is "out of stock". Currently it is not shown price for the products in my magento 2.1.3 installation.

How to make visible it?


texts: Admin Grid (UI Component) - Remove columns from export in magento2

texts: I know there is a way to remove columns from export in magento1 through "is_system" config attribute in UI component. What's the solution in magento2??


texts: Magento 2 use symbol instead of name in currency switcher

texts:
I am trying to figure out how to get the currency symbol instead of the name on the currency switcher in Magento 2. I have done it with php, but I know there is a better way in Magento.

I've created a new file: /app/design/frontend/<Vendor>/theme/Magento_Directory/templates/currency.phtml.

I also added a coin image.

<?php
/**
 * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 */
?>
<?php
/**
 * Currency switcher
 *
 * @see \Magento\Directory\Block\Currency
 */
?>
<?php if ($this->getCurrencyCount() > 1): ?>
<?php $currencies = $this->getCurrencies(); ?>
<?php $currentCurrencyCode = $this->getCurrentCurrencyCode(); ?>
<?php $id = $this->getIdModifier() ? '-' . $this->getIdModifier() : ''?>
<div class="switcher currency switcher-currency" id="switcher-currency<?php echo $id?>">
    <?php echo __('Currency') ?>

        <div class="action toggle switcher-trigger" id="switcher-currency-trigger<?php echo $id?>">
            <strong class="language-<?php echo $this->escapeHtml($this->getCurrentCurrencyCode()) ?>">
                <img src="<?php echo $this->getViewFileUrl('images/coin.png') ?>" alt="currency" /> <?php //echo $this->escapeHtml($currentCurrencyCode) ?><?php
                            $locale='en-AU'; //browser or user locale
                            $currency= $this->escapeHtml($this->getCurrentCurrencyCode());
                            $fmt = new NumberFormatter( $locale."@currency=$currency", NumberFormatter::CURRENCY );
                            $symbol = $fmt->getSymbol(NumberFormatter::CURRENCY_SYMBOL);
                            header("Content-Type: text/html; charset=UTF-8;");
                            echo $symbol;
                            ?>

        <ul class="dropdown switcher-dropdown" data-mage-init='{"dropdownDialog":{
            "appendTo":"#switcher-currency<?php echo $id?> > .options",
            "triggerTarget":"#switcher-currency-trigger<?php echo $id?>",
            "closeOnMouseLeave": false,
            "triggerClass":"active",
            "parentClass":"active",
            "buttons":null}}'>
            <?php foreach ($currencies as $_code => $_name): ?>
                <?php if ($_code != $currentCurrencyCode): ?>
                    <li class="currency-<?php echo $_code ?> switcher-option">
                        <a href="#" data-post='<?php echo $this->getSwitchCurrencyPostData($_code); ?>'><?php echo $_code ?> - <?php
                            $locale='en-AU'; //browser or user locale
                            $currency= $_code;
                            $fmt = new NumberFormatter( $locale."@currency=$currency", NumberFormatter::CURRENCY );
                            $symbol = $fmt->getSymbol(NumberFormatter::CURRENCY_SYMBOL);
                            header("Content-Type: text/html; charset=UTF-8;");
                            echo $symbol;
                            ?>

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

<?php endif; ?>

What is the best way to get magento currency symbol using magento way?


texts: Order Total Due even after successful payment; PayPal Standard Method

texts:
I am using the default Magento PayPal Standard payment method (Magento 1.9.3.6). Everything is correct except that it shows a Total Due even after successful payment. The invoice is created and marked "Paid", but in the Information tab, the "Total Paid" is zero and "Total Due" equals the order grand total. This also causes the order to stay in processing state, even after shipping the order. What's the reason and how should I fix it?

Any help is highly appreciated.

Thank you.


texts: Paypal Hosted Solution and Magento 1.9.0.1 payment discrepancy

texts:
I previously used magento website payments pro but to become more PCI compliant
switching to Paypal Hosted Solution.

I get a difference between what magento says should be paid and what paypal captures
when a discount is applied to a customer account.

For exampled if customer orders £243.74 worth of products with one of the products costing £7.99 with a discount £7.99 so it is free the total should be £235.75 as stated in magento.
When the customer pays by card using the paypal hosted service it captures £234.42.
The difference in the prices is £1.33 from what they have paid and should pay. This works out at being the amount of TAX that would be applicable to the discount.

This occurs with other orders too.

Prices when entered into the system include TAX and
apply customer tax set to after discount
apply discount on prices set to including tax

This does not happen when customer pays by express checkout.

Not sure how to resolve this issue, any help wold be great.

Henry


texts: Change order price display incl. tax and excl. tax

texts:
At the moment the price is displayed like this :

Price incl. Tax
Price excl. Tax

And I would like to display it like this :

Price excl. Tax
Price incl. Tax

In a previous question someone answered that you had to put :
<?php if ($block->hasAdjustmentsHtml()): ?>
    <?= $block->getAdjustmentsHtml() ?>
<?php endif; ?>

at line ~15 of module-catalog/view/base/templates/product/price/amount/default.phtml
(I'm working on a test server, I will override it on the production server)
I tried this and it displayed :

Price excl. Tax Price incl. Tax
Price excl. Tax

I'm not sure what getAdjustementsHtml() does and I can't find it in the catalog file.
I'm quite new to Magento and web in general so I'm a bit lost in Magento's architecture.
Any help will be greatly appreciated
EDIT: I succeeded to obtain something okay for now : activate only excl. tax display and override the price display, then get the excl. tax price, multiply it by the tax rate and display this where you want. This works only if all your products have the same tax rate obviously.


texts: Why I cant return configurable products using default RMA

texts: I am using magento 2.4 enterprise edition. Products I can generate return requests are of type Simple ,Grouped, Bundled. This is default feature supported by magento. Though I wonder why it is not supported for configurable product? Is there any way to do so?


texts: Check if order already exists, and calculate pricing orderRepository

texts:
my question is about importing order via orderRepository, and calculating price.

I've made a script that automatically import order from another webshop into our Magento backend. Now, because there is a cronjob on that script (runs every 5 minutes), the same order gets imported every time the cronjob runs. What is the best way to check if the order is already imported?!

I've add those order via the orderRepository, but when I save one order, all price fields are empty (including Tax column). Now, the QuoteFactory has the collectTotals() method to calculate that automatically for you, but the orderRepository hasn't. Is there some way I can calculate the price and tax automatically, but still use the orderRepository?!


texts: Magento 2 - How to configure Grunt in PhpStorm

texts:
I'm trying to configure Grunt in PhpStorm.

I have set for Grunt:
Node interpreter: /usr/bin/node (exists)
Package grunt-cli: [path to Magento 2 dir]

I get the error bellow when I 'Reload tasks' in PhpStorm.

grunt-cli is installed in the project. I have a [path to Magento 2]/node_modules/ dir.
And grunt clean:[my theme], exec and watch work in console.

I'm aiming to have PhpStorm run grunt watch and refresh the page in browser.

Failed to list grunt tasks in [magento2 dir]/Gruntfile.js: process finished with exit code 8 (a non-zero exit code means an error)
 * Edit settings

$ /usr/bin/node /[magento2 dir]/dev/tools/grunt/tasks/bin/grunt --no-color --verbose --gruntfile /[magento2 dir]/Gruntfile.js --tasks /home/[user]/[some-dir]/PhpStorm/plugins/JavaScriptLanguage/grunt_js/tasks _intellij_grunt_tasks_fetcher

module.js:340
    throw err;
          ^
Error: Cannot find module '/[magento2 dir]/dev/tools/grunt/tasks/bin/grunt'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Process finished with exit code 8

EDIT
Settings that worked with Grunt are:

Node interpreter: /usr/bin/node (exists)
Package grunt-cli: /usr/local/lib/node_modules/grunt-cli

and clicked 'Reload Tasks' icon

EDIT 2
Assuming one configured the project as in:
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html#grunt_prereq
and has configured also the store them in [magento2 dir]\dev\tools\grunt\configs\themes.js

Add a File Watcher in Settings > Tools > File Watchers as explained here:
http://www.kevinfodness.com/automating-grunt-builds-in-phpstorm
with a few differences:

'File Type': Less
In 'Scope' there should be the directory of your theme from vendors/[my namespace]/[my theme dir] because we suppose to change files here. I have added a few more dirs from vendors/[my namespace]/[my modules that have less]
In 'Scope' you don't need to Exclude .css files because these are in pub/static and not in vendors/my_namespace/my_theme dir.
'Program': grunt (my dev machine sees this command globally)
'Arguments': less:my_theme
I could have in 'Arguments' this instead: clean:my_theme exec:my_theme less:my_theme but not sure if I want to. less:my_theme takes already 5 secs to run. You can run clean and exec in console if you need it.
'Outputs path to refresh': I've cleaned it. Nothing here instead of the default field value.

I have set up the watcher and it works. But now I'm thinking why not just use grunt watch in console.
Next step is to find out how PhpStorm can refresh a browser window after it completes the watcher's task. This is why I want to have Grunt in PhpStorm. I don't want to alt+tab in console to see if grunt watch finished the task and than alt+tab to refresh a browser window.


texts: Strategy for migrating new theme to production site

texts:
We installed and configured a new theme on our staging site and I wanted to know what the best strategy is for migrating that new theme to our production site.

We're using git so normally I would just pull the new version on our production site, but with the new theme there have been a lot of changes in the database, mainly new static blocks, but also edits to existing blocks and CMS pages as well as configuration changes.

How do I migrate these changes to the production site, keeping in mind that new products and orders have been made since we branched the staging database?

Right now I'm thinking we should export all of the products, orders and customers from our production site to the staging site, and the staging site will become the new production site. Is there an issue with this approach or is there a better way to handle this migration?


texts: Magento2 Wrong Customer Data showing after login

texts: After Login , customer data is showing from previously logged-in customers data in dashboard , orders, address etc, even after clearing the cache / trying in new private window


texts:
How can I place double quotes around my title: when a user deletes a record from the select drop down in the Admin Grid-the modal pop up should display my title as double quoted

i.e
1.  Delete "XYZ"

2. Are you sure you wan't to delete a "XYZ" record?

'title' => __('Delete ${ $.$data.store_name }'),
                        'message' => __('Are you sure you wan\'t to delete a ${ $.$data.store_name } record?')


texts: Consecutive Order Numbers - Quickbooks and similar accounting services

texts:
One constraint I'm dealing with on a project is for all order numbers to be consecutive in nature.

Current: 1000, 1001, 1003, 1004, 1008, 1010
Desired: 1000, 1001, 1002, 1003, 1004, 1005

Problem Statement

Accounting systems can only record sales receipts and invoices in consecutive numbers. If a non-consecutive number comes through, the accounting system is forced to rewrite the number to a consecutive number.

When that happens, Magento and the accounting system are no longer synced by transaction number. I have a clear understanding of why Magento does not store consecutive order numbers - due to sales quotes being created before order is transacted.

Requirements & Question

The requirement is to keep some form of sync between Magento and the accounting system. That means a transaction number or another identifier.

Questions

Is there a way to maintain consecutive order numbers in Magento without breaking the core?
Is there another common identifier that can be used between the accounting system and Magento if the transaction numbers don't sync up?


texts: How to change url of Proceed to Checkout

texts:
I would like to manually rewrite to mydomain.com/index.php/customer/account/login
Instead of mydomain.com/customer/account/login. As am facing issues due to url rewrite.


texts:
I'm trying to run a cron job on local server for a Magento site, using some of the following commands in terminal:

*/5 * * * * /bin/sh /Applications/MAMP/htdocs/website.local/cron.sh
*/5 * * * * /bin/bash /Applications/MAMP/htdocs/website.local/cron.sh
*/5 * * * * /usr/bin/php /Applications/MAMP/htdocs/website.local/cron.php
*/5 * * * * /usr/local/bin/php -f /Applications/MAMP/htdocs/website.local/cron.php

I am returned with the following:

  -bash: */5: No such file or directory

Can someone please advise how to run a cron job on local server for a Magento site?


texts: Configurable product not visible in frontend

texts:
I imported configure product as CSV files and created its associated products using 'quick simple product creation' and set website and category. But its not displaying in the front end.

How do I solve this issue ?


texts: Magento 2.2.6 - Invalid factory was registered for this instance type

texts:
I have transferred my Magento project to live server and just changed database connectivity credentials. No other change.

and if I run any Magento command

then I get the following error:

  While attempting to create viewjsonstrategy(alias: ViewJsonStrategy) an invalid factory was registered for this instance type.

I have deleted cache files from var/cache, var/page_cache, pub/static/frontend, pub/static/adminpanel, generated/code, generated/metadata but no success.

Please guide if anybody has any solution.


texts:
Let's say I want to send my best customers a free sticker. I have all my best customers in a group aptly named Best Customers. Are there any extensions or programatic ways to create an order of one sticker for all customers in Best Customers?

Maybe I could modify this solution to fit my needs, but I'm not sure how. Any ideas?

Inchoo Programmatically create order


texts: Google sitemap.xml generates product url's without category path

texts:
I generated an sitemap.xml file through the Catalog > Google sitemap area.

What I experience is that the product url's in the .xml appears to be incorrect url-path'wise.

So a product url appears as:
http://www.domain.com/product1.html

While the correct on-site canonical url would be:
http://www.domain.com/category1/subcat/product1.html

In Configuration > Catalog > SEO, all is set to Yes/activated.

Any ideas on why this is happening and how it can be fixed?


texts: Implement Magento 2 checkout type tooltip with a question mark

texts:
I am trying to implement Magento 2 checkout type tooltip with a question mark on the product page next to the custom option text label like shown in the picture. This is not a configurable product. It is a simple product with custom options with only one option which is size. I copied tooltip code from one of the checkout file and inserted in select.phtml as shown below. I am running into couple of issues. One is the tooltip question mark is misplaced on the screen. It is placed on the top right corner of the product page. Second the tooltip content is clickable.

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

// @codingStandardsIgnoreFile

?>

<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?>
<?php
$_option = $block->getOption();
$class = ($_option->getIsRequire()) ? ' required' : '';
?>
<div class="field<?= /* @escapeNotVerified */ $class ?>">

    <label class="label" for="select_<?= /* @escapeNotVerified */ $_option->getId() ?>">
        <?= $block->escapeHtml($_option->getTitle()) ?>

                <?= $block->escapeHtml(__('Information on size')); ?>

        <?= $block->getValuesHtml() ?>
        <?php if ($_option->getIsRequire()): ?>
            <?php if ($_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OP$
                <span id="options-<?= /* @escapeNotVerified */ $_option->getId() ?>-container">
            <?php endif; ?>
        <?php endif;?>


texts: Megento 1.9.3.1 please tell me how to fix this

texts:
Friends this is very major issue,in magento 1.9.3.1 this below issue is frustrating and no solutions I found since last one week.

kindly help me to revert back the cause and solution so that i may get back the all PRODUCTS IMAGES AND BROWSE FILES AND UPLOAD FILES buttons for MAGENTO 1.9.3.1


texts: What is the best way for admins to add PDFs to product pages?

texts:
Our client has several specification sheets in pdf format for many of their products. What is the best or easiest way for them to add a downloadable PDF to each product page. (Some PDFs fit many products).

UPDATE: I found a very useful extension for this http://amasty.com/product-attachments.html


texts: Magento 2.3.4: Customer File Attribute not working from admin

texts:
I followed below blogs in order to create a customer file attribute.
https://blog.chapagain.com.np/magento-2-customer-image-file-upload-in-registration-account-page/
https://meetanshi.com/blog/create-custom-image-attribute-for-customer-in-magento-2/
It works well from admin, I can upload any file from customer account at admin side, but I cannot save it from customer registration form. I need to allow customers to  upload documents during registration.
Any Help on this please ?


texts: how to access token of REST Api in magento 1.9.3.1?

texts:
Hi i searched the around google about this, but nothing find.
can anyone help me to access the token from rest api in magento.

I tried this code in a php file on root and getting blank screen(no output).

<?php
/**
 * Example of retrieving the products list using Admin account via Magento REST API. OAuth authorization is used
 * Preconditions:
 * 1. Install php oauth extension
 * 2. If you were authorized as a Customer before this step, clear browser cookies for 'yourhost'
 * 3. Create at least one product in Magento
 * 4. Configure resource permissions for Admin REST user for retrieving all product data for Admin
 * 5. Create a Consumer
 */
// $callbackUrl is a path to your file with OAuth authentication example for the Admin user
$callbackUrl = "http://192.168.0.78/pooja/testmagento/";
$temporaryCredentialsRequestUrl = "http://192.168.0.78/pooja/testmagento/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://192.168.0.78/pooja/testmagento/admin/oAuth_authorize';
$accessTokenRequestUrl = 'http://192.168.0.78/pooja/testmagento/oauth/token';
$apiUrl = 'http://192.168.0.78/pooja/testmagento/api/rest';
$consumerKey = '5c795558a40557839702605ddf3f6a90';
$consumerSecret = '56a0e944528b995baab7bab4b1a9c53b';

session_start();

if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
    $_SESSION['state'] = 0;
}
try {
    $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
    $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
    $oauthClient->enableDebug();

    if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
        $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
        echo $_SESSION['secret'] = $requestToken['oauth_token_secret'];
        $_SESSION['state'] = 1;
        header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
        exit;
    } else if ($_SESSION['state'] == 1) {
        $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
        $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
        $_SESSION['state'] = 2;
        $_SESSION['token'] = $accessToken['oauth_token'];
        $_SESSION['secret'] = $accessToken['oauth_token_secret'];
        header('Location: ' . $callbackUrl);
        exit;
    } else {
        echo "a= ".$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);

        $resourceUrl = "$apiUrl/products";
        $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));
        $productsList = json_decode($oauthClient->getLastResponse());
        print_r($productsList);
    }
} catch (OAuthException $e) {
    print_r($e->getMessage());
    echo "<br/>";
    print_r($e->lastResponse);
}

Thanks.
Pooja


texts: How add table name prefix to all table after Magento installation

texts:
I need to add table prefix for all the database table.

I know that I can get this option while installing the Magento but I already installed my magento and I don't want to change the database,
I just need to add the prefix for all the tables.

I checked lot for this but I didn't get perfect answer for this.

Can anyone help me to do this,

How can I add prefix to all the tables without any data loss?


texts: mysql fields max length of for each data type

texts:
I am checking for maximum length of each data type fields in magento.

For example "Text" field, magento has many text fields by default, so what is the maximum length of the default text fields.
and I also wanted to know these information

Using trim function or not?
what is default values?

Similar, I wanted to know all the data type max length.

Text:

Text Area:

Email:

Password:

Where I can get all these information?
Can anyone help me to understand all these.?

Thanks in advance for your valuable response


texts: I want to add asynchronous functionality into magento. I am using events to do run some backend processes and these processes can sometime cause long delays. This under some circumstances become unacceptable especially when customer is trying to place an order. Now I want observer to run independently of event. I tried using mage-resque to use queues but it adds one more point of failure and there is no way to know if it is widely used. Are there any job queues that can easily be integrated with magento which are actively updated and don't overuse database? I have tried using magento SNS to send customer SMS but again I don't know if there is a precedent. The truth is I wouldn't want to experiment at this stage without knowing consequence. Any help would be appreciated


texts: Apply coupon observer to set message in cart view

texts: I've created observer method for salesrule_validator_process event. How can I access coupon code and whole cart to check, if there are specific products in cart? If it found products with a specific criteria how to disable applying entered coupon?


texts:
We have a site under Magnento 2.1.0 CE and have been experiencing a strange issue. After being hit hard by traffic (normally hacking attempts or Asian spiders that ignore robots.txt), some pages on the frontend or backend lose their styling.

When we look at what comes back from the server, the page is started at the body tag - there is no <html> or <head> to be found, which is why there is no styling. Experimenting with clearing caches, it is clearing the layout cache that brings the pages back to normal.

There are no relevant errors when presenting these pages. 200 response and no exceptions except when Magento gets confused because some of the page is missing.

We have been using redis cache (just turned this off to see if it makes a difference) and the server setup is nginx 1.8, php 7.0.9 and mysql 5.6.

This problem does remind me of the cache corruption issue in Magento 1, but firstly one would hope this problem would not carry over into Magento 2 and secondly that the php error would have been fixed by v7.

UPDATE: It's worth noting that this problem seems to have gone away by 2.1.3. This isn't an "answer" as such, as it's possible people are stuck on 2.1.0 and would like to solve this.


texts: i want to display Model attribute set in order page

texts: I am Using Magento 2.2 , I want to display  product  model attribute   in attribute set on  order page in backend below sku.


texts: I am working in magento admin panel.My problem is when i create a product then its Wholesale Price is not display in front end. How the wholesale price display in front end. Admin > Add Product > Prices .... Attached screenshot


texts: Upgrade Magento2.3.5-p1 to Magento 2.3.5-p2

texts:
How can update Magento2.3.5-p1 with the security patch to Magento2.3.5-p2?
I can not find the p2 patch on the Magento website; https://magento.com/tech-resources/download


texts: Did something change about overriding code/core files with code/local?

texts:
As demonstrated in this 4 year old document on Magento's site: https://wiki.magento.com/pages/viewpage.action?pageId=10223961

I've used this method in past years and it has worked. Copy directory path and specific file you would like to overwrite to the same location but in "local" instead of "core". Now I'm seeing information that states otherwise and it definitely isn't working in CE 1.9.

https://stackoverflow.com/questions/7110042/cant-seem-to-override-checkout-controller-in-magento

Note: CartController.php is the file/controller I'm working with.


texts:
Is there a reason to use Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) rather than Mage::getBaseUrl()? I've seen both in use, and they both return the same thing. Is the longer one redundant? It uses 2 function calls, as well.

Moreover, I see that Mage_Core_Model_Store::URL_TYPE_WEB simply returns the string 'web'. What's the point of it?


texts: How to get shipping quote in magento 1.9

texts:
I added two products to my cart and proceeded for checkout.
I the customer from canada and the store belongs to US
When I place my order am Unable to get shipping quote instead am getting this message

  Sorry, no quotes are available for this order at this time.

Can someone suggest me, what changes should I do in magento admin at shipping methods? or where should I make changes? Just please guide me.


texts: magento2 discount gets refreshed and disappears in checkout page

texts:
I have a bug with magento2.0.7 at checkout page.

I built a custom cart price rule that applies 60% to the most expensive product in the cart.

Everything works fine and the discount is applied to the right product and in the database the discount is applied in the quote tables on the right cart item.

In the cart page the discount is visible and the total is correct but when going to checkout page, the discount applied appears for a few seconds then an ajax call from a totals.js is refreshing and the discount disappears.

Please if you have any idea for a workaround to get over this bug, share your solution with me.


texts: Is there any way to deactivate Magento shop and use it only as a catalog?

texts:
Is there any way to deactivate Magento's Shoping functionality such as "Add to cart", cart etc. and use Magento only as a catalog?

I'm using Magento 1.9.

Thanks


texts: Magento 2.1: How to get attribute value as text in response of product rest api

texts: I have created a custom attribute "color" and it has the values Red, Green, Blue. When I call /V1/products/:sku it shows the product details and also shows the custom_attributes{"attribute_code":"color","value":"74"}. I want the value of the attribute is "Red" instead of 74 (It's ID).


texts: I want to show product price in 1 pack but sale on whole cartoon pack in magento

texts:
I am new to magento platform.

1) I want to show product and price (1 pack=10 pecs) like actual price 384 and special price 326.

2) but sale whole cartoon (1 cartoon=8 pack) like actual price 3072 ...


texts:
I am using Postman to post special-price but it's with REST API like so: Post URL: http://magento2/rest/V1/products/special-price

Payload:

{
 "prices": [
  {
   "price": 50.00,
   "store_id": 0,
   "price_from": "2017-07-15 00:00:00",
   "price_to": "2018-09-16 23:59:59",
   "sku": "1565_6338"
  }
 ]
}

REF: https://devdocs.magento.com/guides/v2.2/rest/modules/catalog-pricing.html

This works as intended But Cannot find anywhere on the web references for the same call as SOAP API xml and payload examples and post url's.

Anyone knows?


texts: System Config page at backend is showing Blank page

texts:
It shows blank page when navigating to System -> Configuration as shown in below image-

and after changing in 'current configuration scope' dropdown to any website view or store view it shows 404 error on the page like below.

I don't know why it's happening, may be any module is cause of this or anything else ?

Please suggest.

Thanks


texts: Magento 2 : Add Dynamic Option for custom form in admin

texts:
I want to add dynamic input field for my custom admin form.
I have found a solution :How to create a dynamic fields in admin form? but it's for system configuration and I want this option in my custom form.
Here you can see I have created the form:
protected function _prepareForm()
{
    /** @var Event $model */
    $model = $this->_coreRegistry->registry('vendor_test');

    /** @var \Magento\Framework\Data\Form $form */
    $form = $this->_formFactory->create(
        ['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]
    );

    $form->setHtmlIdPrefix('branch_');

    $fieldset = $form->addFieldset(
        'base_fieldset',
        ['legend' => __('Branch'), 'class' => 'fieldset-wide']
    );

    if ($model->getId()) {
        $fieldset->addField('id', 'hidden', ['name' => 'id']);
    }

    $fieldset->addField(
        'address',
        'textarea',
        ['name' => 'address', 'label' => __('Address'), 'title' => __('Address')]
    );

    $fieldset->addField(
        'phone',
        'text',
        ['name' => 'phone', 'label' => __('Phone'), 'title' => __('Phone')]
    );

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

    return parent::_prepareForm();
}


texts: How to remove Size filter section from layered navigation in magento 1.9.01

texts:
How to remove Price filter from layered navigation? I set Layered Navigation in Manage Attribute section size as 0 but still the Size filter is showing in left side under Shop by section.

Can anyone assist me resolving this issue?


texts: I created a modal widget that appears after adding product to cart, it works perfectly .Now I need to close the modal after 5 seconds.please help!


texts: When I am trying to run setup:upgrade its always gives below error,

texts:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE 446 WHERE `Non_unique` = 1' at line 1, query was: SHOW INDEXES FROM 434 WHERE 'Non_unique'=1

due to above error I am unable to install any modules.
Please help someone at the earliest how to resolve this?


texts: What's the best way to implement a custom login/authentication controller for magento [v.1.6.0]?

texts:
I've found a number of examples on how to set up Magento to authenticate customer login but none of them seem to work and some seem to contradict themselves or each other.

For example, one suggests a  block in the config.xml for the extension while another suggests a  block. Some have a  block in the same file and others don't. One mentions how to do this for Magento 1.3 which is fine, exception v1.4 itself is about four years old!


texts: Can I put a timeframe on a Magento Category?

texts: I want to add a "New" subcategory to each of my main product categories.  When I enter a new product into my store I would like to set a date for how long it appears in that category.  Then on the date expiration its now longer "New."  Is that a default feature or extension purchase?  Or code myself.


texts: M2.3.3: Sending different order confirmation email if payment method is bank transfer

texts: How to send a different kind of order confirmation email (maybe using different email template or just add some extra text to the one template) if customer has used bank transfer payment method?


texts:
I'm not sure what caused this but out of nowhere my blocks in the backend of my Magento is not loading it sits there with a loading icon. https://imgur.com/a/9Osu2

I am also getting this error with a testing app

  SyntaxError: Unexpected token < in JSON at position 85512
   /mag2/admin_wn/cms/block/index/key/51437802668f4a31878d4716a028c355039b45eababcfdf8d8a951fa07ed2b47/:1

Magento Version: 2.2.2

PHP Verison: ea-php71

Litespeed Verison:

5.2.3 (build 0) Active
MariaDB:  10.1

Cloudlinux: CLOUDLINUX 6.9

I've tried the following:

Increasing max_memory from 128M to 512M.
Full System Restart / MYSQL Restart/Litespeed Restart
Cleared Local Cache/DNS/Restarted Computer/Different PC/Internet
Cleared Static/Var folders/files.
Reindexed


texts: Home page requires 'home' or index.php otherwise give autoload error

texts:
I installed Magento 2.3 successfully on one server and then moved it to another server by copying the files to public_html and uploading the database. It didn't work at first so I had to do various CLI commands including composer install and composer update. Now it works and all looks good inside admin but when you try and access the domain the home page only loads if I include 'home' or index.php after the URL

e.g. www.mydomain/home or www.mydomain/index.php work, www.mydomain does not work.

This is the error (which is incorrect - I already did a composer install), how do I fix this, did I transfer the site the wrong way?

Autoload error

Vendor autoload is not found. Please run 'composer install' under the application root directory.


texts: How to read data in CSV file and store it to database in Magento 2

texts:
$data = [
            [
                'data_id' => 1,
                'name' => 'Name1',
                'bonus_points' => 123.45
            ],
            [
                'data_id' => 2,
                'name' => 'Name2',
                'bonus_points' => 678.90
            ],
            [
                'data_id' => 3,
                'name' => 'Name3',
                'bonus_points' => 545
            ]
        ];

I want to read below csv file and form exact array $data as given above

Will someone please provide me exact code. I am new to magento.


texts: Magento2 Ui Component - How to create dynamic rows attribute like custom options on the product form?

texts:
kindly give me a solution / advice for how to achieve this following concept in magento 2.

I want to implement this concept on the product edit form at admin side, also i want to fetch and get updated saved values.

Concept:
I need to setup / create new attribute like custom option, for ex:

Lable: Delivery information

Field in row: Destination and Days to deliver

Field 1 : Destination (Select type)

Field 2: Days to deliver (Text box, validate Integer Only)

Add Value : Used to create new row to select and enter different values

As Image, Should be like this

Based on these information i need to filer those products by destination and delivery day.

Thanks in advance.


texts: Magento2 : Cannot add order comment "We cannot add order history" error

texts: Magento2.3.5 I have trouble of adding comment to customers order. I can sent to one store view (Thai) but another store view show "We cannot add order history". in the order comment box. Anyone know how to fix?


texts:
When people sign up on my webshop they are automatically assigned to a customer group.
When they first create a user they get the following success message on the dashboard;

Thank you for registering with //webshop name//.
If you are a registered VAT customer, please click here to enter you billing address for proper VAT calculation.

The problem is that I do not use VAT in my shop.
I've been looking through the local files, but I can't find it anywhere. How do I change or delete this message?


texts: Want to change Payment method title in order detail page

texts:
I want to change my new added payment method title in the order details page. There is a dynamic type which I get via my payment gateway.

It has to be like {my payment method title} /{that variable}. Which in my case would be like a {my payment Method} / wallet. I am getting the value of that variable in my controller file of my extension.


texts: Magento 2: Set default select drop down option

texts:
Is there a way to set the default option for a select drop down on the frontend product page?

At the moment 'Please select...' is the default option.

<select name="options[22]" id="select_22" class="required product-custom-option admin__control-select" title="" >
    <option value="" >-- Please Select --</option>
    <option value="22"  price="0" >United Kingdom</option>
    <option value="30"  price="0" >USA</option>
    <option value="40"  price="0" >Europe</option>
</select>


texts:
I have got a product that has lots of colour/fabric/style options for each product. If I add them then it pushes "Add to basket" button below the fold.

Is it possible to show product attributes/options in new popup window or in a tab?

As an example, I would like something like this,

https://www.darlingsofchelsea.co.uk/kingly# (click on "Choose a leather" and you will see that options open in new pop)

or

https://www.sofa.com/gb/sofas/breakdownable-sofas-%28for-easy-access%29/descartes-sofa/p/SO-DSC (click on "Pick fabric" then options open in tab on the page)

Any help from you will be appreciated.

Thanks


texts: Localhost Magento 2 — How to access on network?

texts:
I have installed Magento 2 to run locally (127.0.0.1) on a computer running Ubuntu.
Eveything works and I am hoping to now be able to access it from other PC's on the network.

  Can anyone point me in the right direction on what to do?

Installing Magento 2 was difficult, so I don't want to mess that up (used Linux for the first time to install magento)

Edit to make clear my goals:

Be able to access magento admin (installed on a machine running ubuntu) from other pc's on the network. Magento is currently configured as 127.0.0.1.

I assume I need to change 127.0.0.1 to the LAN IP somewhere (an apache config, and/or the sqldb?)


texts: Magento 2 add new argument in the reference block and get into the phtml

texts:
I am working on reference block concept, in that I need to add new arguments and get the argument value on the .phmlt file.

in catalog_product_view.xml I've added the below line of code.

 <referenceBlock name="product.info.addtocart">
        <arguments>
            <argument name="current_page" xsi:type="string">detail</argument>
            <argument name="all_page" xsi:type="string">all</argument>
         </arguments>
         <!-- <action method="setData">
                 <name>current_page</name>
                 <value>detail</value>
                 <name>all_page</name>
                 <value>all</value>
        </action> -->

       <block class="Learn\Test\Block\Sample" name="sample.otherproducts" as="sample.products" after="-" template="catalog/product/view/sample.phtml" />
</referenceBlock>

Then in my sample.phtml file I am using the following lines for getting the value of the arguments

$this->getData('current_page');
$this->getCurrentPage();

But nothing is get the value of the current_page arugment, what is the exact procedure to bind the value on reference block layout and get it into the .phtml file

Kindly share your thoughts and ideas, thanks in advance for your support


texts: Some products not showing up on frontend after magmi import

texts:
After importing 277 products with magmi to magento 230 of the products are not showing up on the frontend.  They are on the Backend under managage prodocts and are 277 are shown to be assigned to a category.

So far I've

cleared the cache
re-indexed
made sure the product is assigned to a category
made sure the product is In Stock
made sure the product has a qty assigned
Going to a missing products URL gives a 404
Tried deleting and re-adding products

Below is sample from the CSV I imported into magmi, the first one does not show successfully on the frontend but the second one does.

sku manufacturer    name    attribute_set   subgroup_desc   category_ids    type    configurable_attributes hoi_conf_ring_size  hoi_conf_frame_size description short_description   hoi_manufacturer_sku    price   special_price   rrp qty is_in_stock manage_stock    use_config_manage_stock status  visibility  weight  manufacturer_info   tax_class_id    store   thumbnail   small_image image   media_gallery
DKLPU1  Brand 1 Large Celtic Knot Pendant   Jewellery   Pendant 230,182,211 simple              Large Celtic Knot Pendant   Large Celtic Knot Pendant       48.95           10  1   1   1   1   Catalog, Search 0   Brand 1 Taxable Goods   admin   DKLPU1.jpg  DKLPU1.jpg  DKLPU1.jpg  DKLPU1.jpg
MAUCR4/S    Brand 2 Medium Silver Circles Pendant   Jewellery   Pendant 230,182,211 simple              Medium Silver Circles Pendant   Medium Silver Circles Pendant       183         10  1   1   1   1   Catalog, Search 0   Brand 2 Taxable Goods   admin   MAUCR4.jpg  MAUCR4.jpg  MAUCR4.jpg  MAUCR4.jpg

I had success importing 3 other batches of products with magmi but am not sure what to do.


texts: Magento2 : When making configurations options in configurable product sku undefined

texts:
When I add configurations to a configurable product the options get the sku undefined+attribute and not the name or sku of the configurable product. See screenshot below

Magento version: 2.1.10


texts:
I added custom tab in product page and then showed necessary information in custom file with name: customtabinfo.phtml, now i need display attrubutes, but when i try get attribute:
<?php echo $_product->getAttributeText('custom_attribute'); ?> - i see error: Fatal error: Call to a member function getAttributeText() on a non-object.

How i can display my attribute?
Thanks


texts: Magento 2: Show multiple grids in a page without using UI components

texts:
I have a specific requirement in Magento 2. I need to show two grids on a single page using Block classes (without using UI components).

I have created one of the grids successfully, but I am not abler to find a way to show the second grid.

Please help me if anyone has any idea how to achieve this?

Edit:
Screenshot


texts: Magento 2: How to submit form on checkbox click?

texts:
Can someone help me?

I need to know how to send the form checkout/cart/updatePost when clicking on a checkbox. It should include an input field hidden or similar with the name=udpate_cart_action and a value.

When we pulse on:

<button type="submit"
    name="update_cart_action"
    data-cart-item-update=""
    value="update_qty"
    title="<?php echo $block->escapeHtml(__('Update Shopping Cart')); ?>" class="action update">
     <span>
          <?php /* @escapeNotVerified */ echo __('Update Shopping Cart'); ?>
     </span>
</button>

We send a param in the request object with the name and value.

But I don't if I must to send this name and value with the checkbox or in the JavaScript...

I have this input type checkbox foreach item

<input id="item_<?php echo $block->escapeHtml($itemId) ?>" name="item[check][<?php echo $block->escapeHtml($itemId) ?>]"  type="checkbox" class="check_item" value="<?php echo $block->escapeHtml($itemId) ?>"

And this code javascript:

<script type="text/javascript">
    $(document).ready(function() {
        $(".check_item").on("change", ":checkbox", function() {
            console.log("check");
        });
    });
</script>

But when I pulse on checkbox and it's status change nothing happens :-(

UPDATE

Thanks, Philipp Sander your answer was correct. The problem was to add

  require(['jquery'], function ($){ //code ]);

<script type="text/javascript">
    require(['jquery'], function ($) {

        $(".check_item").change(function() {
            if(this.checked) {
                $("#update_baa").click();
            } else {

                $("#update_baa").click();
            }
        });

    });

</script>

Thanks!!


texts: Tax on product issue (inclu = exclu) but calculated on freigt charges

texts: I have a problem with the tax culation in my system. I haven been searching since several days but I can not find where the issue lays. I have even tried by putting my product on tax-rate shipping, ...


texts: How to check if a product exists in catalog, rather than deleted, when on Order View page?

texts:
Ok, so I've learned how to make the product name a clickable link (when viewing an order as admin) to that product's Edit Page on our Admin Dashboard - here's the post w/ answer.

The answer shows this is the code to add to:

app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

<?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?>
<a target="_blank" rel="external" href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $_pullProduct->getId()))?>">
<?php echo $this->getColumnHtml($_item, 'name') ?>

This works perfectly, except for one thing: If the order has a product that has been deleted, that snippet of code that gets the product URL can't find the product, since it's been deleted, and the HTML stops loading at that line, breaking the Order View page for that order.

Orders with products that have not been deleted work fine with this bit of code.

How might I go about only linking to the product URL if the product exists in the product catalog and has not been deleted?

Btw, These products are deleted forever, rather than simply disabled. Disabled products work fine.

Edit/Update:

Thanks for the answers - Both look great, and I believe Fabian's answer was closer to was I was looking for - Here's a question for Fabian's answer, which I attempted to ask in the comment form, and didn't look too good, so I shall ask in a more readable way here:

I'm having a problem figuring out how to implement your answer and is most likely because I'm slowly learning PHP, but I'm not too experience with it since my main job is design, but I do manage to get by with the bit of PHP I've needed to learn. I attempted:

using...

if(!$product->isObjectNew()): do something

and I ended up trying...

    <?php echo $this->getColumnHtml($_item, 'name') ?>
        <?php if(!$product->isObjectNew()): ?>
            <?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?><a target="_blank" rel="external" href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $_pullProduct->getId()))?>">View
        <?php endif; ?>

...and this does not work, and I understand it's because I'm incorporating:

if(!$product->isObjectNew()): do something

improperly.

I'm not sure what my flaw is, even after looking at similar code in other phtml files on the site, attempting to copy what I see, and I'm still unable to figure this out. This is where I could use help from you guys, this would be a great opportunity for me to learn something.


texts:
I receive an error when I want to update my products.

I got the following error;

  SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

query was:

DELETE FROM `catalog_product_entity_int`

WHERE (attribute_id = '96') AND (entity_id = '55844') AND (store_id <> 0)

How can I solve this?

After setting innodb_lock_wait_timeout to 120, I get the following error report from Magento:

a:5:{i:0;s:41:"SQLSTATE[HY000] [2002] Connection refused";i:1;s:1777:"#0 /public_html/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /public_html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 //public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /public_html/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Array)
#7 /public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(141): Mage_Core_Model_Resource->getConnection('core_setup')
#8 /public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(234): Mage_Core_Model_Resource_Setup->__construct('core_setup')
#9 /public_html/app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#10 /public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#11 /public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#12 /public_html/index.php(83): Mage::run('', 'store')
#13 {main}";s:3:"url";s:85:"/index.php/admin/catalog_product/index/store/0/key/83a8e99002e7976f0d262a923a214f92/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}


texts: magento2 knockoutjs custom template binding

texts:
I'm trying to understand knockoutjs in magento2.especially custom template binding.I'm not able to get idea flow of rendering this.

Can any one have idea how it works?
atleast Where can I find definition of getTemplate?

<!-- ko if: (!quoteIsVirtual) -->
            <!-- ko foreach: getRegion('customer-email') -->
                <!-- ko template: getTemplate() --><!-- /ko -->
            <!--/ko-->
        <!--/ko-->


texts: Product Attribute in Terms and Conditions

texts:
Magento 1.9.1.0 - One Page Checkout - Terms and Conditions

Our store has one set of main terms and conditions.
A few products have extra T&C's to add to the main set of terms.

We've created a new attribute so that any product that needs the additional data can be displayed at the top of the standard terms.

I can see that Base > Default > Checkout > onepage > agreements.html
is the place to insert the code, but I can't seem to get it displaying.


texts: Where is setDoNotUseCategoryId() declared and what does it mean?

texts:
While getting related products, cross sells and upsells and collections, the function setDoNotUseCategoryId() is used.

Where is it declared and can you explain the usage?

    foreach ($this->_itemCollection as $product) {
       // var_dump($product);exit;
        $product->setDoNotUseCategoryId(true);
    }


texts: Solution to Magento Downloader 1.9.2 unknown cipher list

texts:
We fixed this by commenting out line 377 in downloader/lib/Mage/HTTP/Client/Curl.php

//$this->curlOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1')

There may be a setting that lets this pass through but we did not get that far.


texts: Magento connect to Redis from different server

texts: I need help here to configure Magento local.xml file. I have two server here. One is running the magento and the other one is running Redis. Basically, it just work fine if we run redis on the same server with magento, right. But I have problem to connect redis from different server. How to configure it?