magento2 – Magento 2 fresh install, admin page 404, css 404, js 404

Problem

I’ve got a fresh install of magento 2 on ubuntu 20.04. I followed the install with composer guide on the mangento site. The installer completed with no complaints.

When I head over to my url I get a very sparse looking page with no css or js. A look in the console and network tab shows that the page is trying to load a number of assets but non are found.

GET https://website.com/pub/static/version1606418294/frontend/Magento/luma/en_GB/css/styles-m.css
(HTTP/1.1 404 Not Found 58ms)

Looking into pub/static shows no directory called version1606418294 perhaps this is a clue?

In addition to this heading over to the admin URI that was generated on installation gives a 404 for the whole page.

Things I’ve Tried

changing mode between development / production / default

deploying static content and flushing the cache

php bin/magento setup:upgrade
bin/magento setup:static-content:deploy -f
bin/magento indexer:reindex
bin/magetno cache:flush

these are the current permissions

ls -la
total 1816
drwxrwxrwx 12 magento www-data   4096 Nov 26 19:16 .
drwxr-xr-x  4 root    root       4096 Nov 25 13:09 ..
-rwxrwxrwx  1 magento www-data    188 Nov 26 18:21 .editorconfig
-rwxrwxrwx  1 magento www-data  11281 Nov 26 19:16 .htaccess
-rwxrwxrwx  1 magento www-data  11382 Nov 26 18:21 .htaccess.sample
-rwxrwxrwx  1 magento www-data   1519 Nov 26 18:21 .php_cs.dist
-rwxrwxrwx  1 magento www-data    101 Nov 26 18:21 .user.ini
-rwxrwxrwx  1 magento www-data 766543 Nov 26 18:21 CHANGELOG.md
-rwxrwxrwx  1 magento www-data    650 Nov 26 18:21 COPYING.txt
-rwxrwxrwx  1 magento www-data   2994 Nov 26 18:21 Gruntfile.js.sample
-rwxrwxrwx  1 magento www-data  10364 Nov 26 18:21 LICENSE.txt
-rwxrwxrwx  1 magento www-data  10376 Nov 26 18:21 LICENSE_AFL.txt
-rwxrwxrwx  1 magento www-data    700 Nov 26 18:21 SECURITY.md
drwxrwxrwx  4 magento www-data   4096 Nov 26 18:21 app
-rwxrwxrwx  1 magento www-data    150 Nov 26 18:21 auth.json.sample
drwxrwxrwx  2 magento www-data   4096 Nov 26 18:21 bin
-rwxrwxrwx  1 magento www-data   2634 Sep 23 20:01 composer.json
-rwxrwxrwx  1 magento www-data 937015 Nov 26 18:21 composer.lock
drwxrwxrwx  4 magento www-data   4096 Nov 26 18:21 dev
drwxrwsrwx  3 magento www-data   4096 Nov 26 19:46 generated
-rwxrwxrwx  1 magento www-data     57 Nov 26 18:21 grunt-config.json.sample
-rwxrwxrwx  1 magento www-data   1370 Nov 26 18:21 index.php
drwxrwxrwx  4 magento www-data   4096 Nov 26 18:21 lib
-rwxrwxrwx  1 magento www-data   5842 Nov 26 18:21 nginx.conf.sample
-rwxrwxrwx  1 magento www-data   1416 Nov 26 18:21 package.json.sample
drwxrwxrwx  2 magento www-data   4096 Nov 26 18:21 phpserver
drwxrwxrwx  6 magento www-data   4096 Nov 26 18:21 pub
drwxrwxrwx  7 magento www-data   4096 Nov 26 18:21 setup
drwxrwsrwx  8 magento www-data   4096 Nov 26 19:46 var
drwxrwsrwx 84 magento www-data   4096 Nov 26 18:21 vendor

rewrite module is enabled

a2enmod rewrite 
Module rewrite already enabled

here’s a list of php modules while im at it

php -m
(PHP Modules)
bcmath
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

(Zend Modules)
Zend OPcache

I read that changing .htacces in the projects root folder to affect symlinks might help, though neither of those two options seems to make any difference.

 13 ############################################                                                                      
 12 ## enable rewrites                                                                                                
 11                                                                                                                   
 10 #    Options +FollowSymLinks                                                                                      
  9 Options +SymLinksIfOwnerMatch                                                                                     
  8                                                                                                                   
  7     RewriteEngine on                                                                                             

added the following to the bottom of /etc/apache2/sites-available/000-default.conf as per magento’s trouble shooting instructions. here and here.

  4   <Directory /var/www/html>                                                                                       
  3           Options Indexes FollowSymLinks                                                                          
  2           AllowOverride all                                                                                       
  1           Require all granted                                                                                     
48    </Directory>    

I logged into mysql to see if magento is speaking to it but it seems to have made a whole bunch of tables so is probably ok?

mysql> show tables;
+------------------------------------------------------+
| Tables_in_magento                                    |
+------------------------------------------------------+
| admin_analytics_usage_version_log                    |
| admin_passwords                                      |
| admin_system_messages                                |
| admin_user                                           |
| admin_user_expiration                                |
| admin_user_session                                   |
| adminnotification_inbox     
.
.
.
| wishlist                                             |
| wishlist_item                                        |
| wishlist_item_option                                 |
| yotpo_order_status_history                           |
| yotpo_rich_snippets                                  |
| yotpo_sync                                           |
+------------------------------------------------------+
404 rows in set (0.02 sec)

I’m pretty much out of ideas, any insight or direction would be greatly appreciated.

magento2 – Watermark issue – Magento Stack Exchange

Currently we are running on Magento 2.2.6.
We have added a watermark for the base, thumbnail, swatch & small.

The watermark is appearing on the productlist page, but not in a good manner, see image.

But the worse thing is, it isn’t even showing on the productdetail page. Yes I see the image but not a watermark. Herefore i’m searching a solution. The first issue will be related to this older version of magento we are running.

enter image description here

Hopefully anyone has some experience for this topic and thanks for the help.

Regards,
Pascal

Regards,
Pascal

magento2 – set Discount Amount to Quote Item

i working on module where multiple quote can be created and you can add custom discount to any quote (this working fine). After adding product when i place order discount become zero mean (order place with actual product price).

what i think i should do
before saving adding product to quote i divide custom discount of quote to quote items and add discount to each quote item, but discount value to quote items is not saving.

here is code snippet

public function itemDiscount($quote)
    {
        $total =  $this->session->getCustomDiscount();
//        var_dump($total);
//        exit();
        if ($total != 0) {
            $total_items = count($quote->getAllVisibleItems());
            foreach ($quote->getAllVisibleItems() as $item) {
                $rate = +$total / $total_items;

                $customAmount = $rate +  ($item->getPriceInclTax() * $item->getQty());
//                var_dump($total_items);
//                exit();
//                $rat = $item->getPriceInclTax() / $total;
//                $ratdisc = $discountAmount * $rat;
                $item->setDiscountAmount($rate);
                $item->setBaseDiscountAmount($rate);
//                $item->setDiscountAmount($rate);
                $item->setPrice($customAmount);
                $item->setCustomPrice($customAmount);

//                $item->setData('base_discount_amount', 9);
//                $item->setData('discount_amount', 89);
//                $item->setData('custom_price', 56);
//                $item->save();
//                $item->setBaseDiscountAmount(($item->getBaseDiscountAmount() + $ratdisc) * $item->getQty())->save();
//                $item->setBaseDiscountAmount($rate);
//                $item->save();
            }
        }
    }

i tried all this solution or ways but discount value is not save to quote items.

How to add allowed methods list in magento2 shipping using custom extension?

    <each if="!quoteIsVirtual" args="getRegion('customer-email')" render="" />
    <each args="getRegion('address-list')" render="" />
    <each args="getRegion('address-list-additional-addresses')" render="" />

    <!-- Address form pop up -->
    <if args="!isFormInline">
        <div class="new-address-popup">
            <button type="button"
                    class="action action-show-popup"
                    click="showFormPopUp"
                    visible="!isNewAddressAdded()">
                <span translate="'New Address'" />
            </button>
        </div>
        <div id="opc-new-shipping-address"
             visible="isFormPopUpVisible()"
             render="shippingFormTemplate" />
    </if>

    <each args="getRegion('before-form')" render="" />

    <!-- Inline address form -->
    <render if="isFormInline" args="shippingFormTemplate" />
</div>
    <each args="getRegion('before-shipping-method-form')" render="" />

    <div id="checkout-step-shipping_method"
         class="step-content"
         data-role="content"
         role="tabpanel"
         aria-hidden="false">
        <form id="co-shipping-method-form"
              class="form methods-shipping"
              if="rates().length"
              submit="setShippingInformation"
              novalidate="novalidate">

            <render args="shippingMethodListTemplate"/>



            <div id="onepage-checkout-shipping-method-additional-load">
                <each args="getRegion('shippingAdditional')" render="" />
            </div>
            <div role="alert"
                 if="errorValidationMessage().length"
                 class="message notice">
                <span text="errorValidationMessage()" />
            </div>
            <div class="actions-toolbar" id="shipping-method-buttons-container">
                <div class="primary">
                    <button data-role="opc-continue" type="submit" class="button action continue primary">
                        <span translate="'Next'" />
                    </button>
                </div>
            </div>
        </form>
        <div class="no-quotes-block"
             ifnot="rates().length > 0"
             translate="'Sorry, no quotes are available for this order at this time'" />
    </div>
</div>

magento2 – Magento 2 change Ship button in Order functionality

I’m trying to change the functionality of Ship button when you choose an order.

The only thing that I have found so far is this file under /vendor/magento/module-sales/Block/Adminhtml/Order/View.php:

I see this part where the button has an onclick method:

 $this->addButton(
                'order_ship',
                (
                    'label' => __('Ship'),
                    'onclick' => 'setLocation('' . $this->getShipUrl() . '')',
                    'class' => 'ship'
                )
            );

and then this is the URL

public function getShipUrl()
    {
        return $this->getUrl('adminhtml/order_shipment/start');
    }

I don’t know if that url is a controller, I have not found a route with that id nor that exactly path. Or maybe it’s an api? This is the url that is shown on backend when I inspect

admin/order_shipment/start/order_id/60/key/ec0160f0fda15ac0271c4a0e1e2115471f7535673cc0e69f5c3af11deaba9ddf/'

Hope someone can give me a hint!

thanks

magento2 – Downgrade composer version 2 to 1

The "magento/magento-composer-installer" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
The "magento/inventory-composer-installer" plugin was skipped because it requires a Plugin API version ("^1.1") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.

I am facing the above issue, I need to downgrade Magento2 composer version. How can i downgrade composer version 2 to 1.

magento2 – Magento 2 Item with the same ID “24” already exists error

I don’t know what is going on, but everytime I go to Sales > Orders, I see this error message:

Item (MagentoFrameworkViewElementUiComponentDataProviderDocument) with the same ID “24” already exists.

I accesed to db in order to check if there was an item_id = “24” but there is nothing.

I don’t know what could it cause.
This error message came when I created a custom order status on admin panel. Then I tried to delete this order status, but the error is still there, and I cannot do anything on Sales > Order.

The weird thing is that I can see the Invoices and Shipments, but not the Orders.

I have tried this commands:

php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy 
php bin/magento cache:clean
php bin/magento cache:flush

none of this worked.
Please help