Magento backend error: Edit user - magento

I get an error in Magento 1.6.1.0 backend:
System -> Permissions -> Users -> Edit user
When I try to access this page nothing gets loaded into content area. Page layout and menus are displayed but the form for user editing is not.
In Firbug it throws the following error:
$("user_user_roles") is null
This line comes from
app/design/adminhtml/default/default/template/permissions/user_roles_grid_js.phtml
which has not been touched.
I did an update from 1.6.0.0 to 1.6.1.0 ... could create and edit users in the old version but I am not able to do it now. Could not find anything on the web for this error.
Please let me know if there is a fix to this.

I also got this error. Here is what I did to fix.
Open file Roles.php in app/code/core/Mage/Adminhtml/Block/Permissions/User/Edit/Tab/Roles.php and add getRowUrl() function:
public function getRowUrl($row) {
return $this->getUrl('*/*/edit');
}
Hope this helps,
Neo.

Related

Debugging FPDF invalid call after upgrading laravel and PHP8

I have a web app that used FPDI to create pdf files, using laravel 5.7, setasign/fpdi-fpdf ^2.0 and PHP 7.4.
I recently upgraded to laravel 9 (also upgrading respective dependencies) and because the meta package was depcrecated, I now use "setasign/fpdf": "^1.8", "setasign/fpdi": "^2.0" as well as PHP 8.0.26
Now when trying to run my script I get the error "FPDF Error: Invalid Call" with the whole trace in the error handler, but I find this error message only semi informative.
Any ideas how I can debug this error?
Does FPDI have issues with PHP8? I didn't see any mention of that in the documentation.
thanks in advance!
From FPDF code, the error is shown when state == 1
fpdf.php#L1458
protected function _out($s)
{
// Add a line to the current page
if($this->state==2)
$this->pages[$this->page] .= $s."\n";
elseif($this->state==0)
$this->Error('No page has been added yet');
elseif($this->state==1)
$this->Error('Invalid call');
elseif($this->state==3)
$this->Error('The document is closed');
}
And state 1 is when the page ends
fpdf.php#L1128
protected function _endpage()
{
$this->state = 1;
}
Which happens when you close the document by calling output() (and when you switch to the next page but that automatically opens the next page).
So you might also have to read the new documentation of FPDF and adapt the code related to it.

ASP.NET Core 6 MVC : adding identity failing

I'm using VS 2022, ASP.NET Core 6 MVC and Microsoft SQL Server 2019 (v15).
Git project: [https://github.com/Wizmi24/MVC_BookStore]
I'm trying to add --> new scaffolded item --> identity.
Default layout page, override all files and mine Data context
when I click add, I get this error:
There was an error running the selected code generator:
'Package restore failed. Rolling back package changes for 'MyProjectName'
I cleared NuGet Package cache as I saw it may help, but all it do is just prolong and this same error is visible after trying to install Microsoft.EntityFrameworkCore.SqlServer, which is installed. I checked the packages and made sure they are the same version (6.0.11).
I cloned your project to test, and the problem you mentioned did appear. Not sure why, but I finally got it working by updating the NuGet package:
I updated the two packages Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Relational to version 7.0.1 (you need to pay attention to the sequence when updating), then add scaffolded Identity, and I succeeded.
You can try my method, if the Identity is successfully added, but the following exception is encountered at runtime:
You need to add builder.Services.AddDbContext<MyBookContext>(); before
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<MyBookContext>();
MyBookContext is the Data context class selected when you add Identity:
In addition, if there is a 404 error in your area routing, you can refer to this document to modify it.
Hope this can help you.
Edit1:
I think it might be a problem caused by naming duplication. Please try to change the name of the context generated by Identity.
As you can see, the ApplicationDbContext generated by Identity is consistent with the ApplicationDbContext namespace in your MyBook.DataAccess:
So naming the same will cause conflict:
So you need to change the naming to avoid conflicts. For example:
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(
builder.Configuration.GetConnectionString("DefaultConnection")
));
builder.Services.AddDbContext<ApplicationDbContextIdentity>();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContextIdentity>();
Edit2:
As I mentioned in the original answer, if you get a 404 error, you can try to refer to this link to fix the area routing.
The easiest way is to directly change the routing settings in Program.cs:
app.MapAreaControllerRoute(
name: "Customer",
areaName: "Customer",
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
Then add the Area property to the controller:
[Area("Customer")]
public class HomeController : Controller{}
There seems to be a problem with your Repository.cs, so I changed the Index to only output a string to test the result.
public string Index()
{
return "success";
}
Test Result:
If your Repository.cs also has problems when you test it, you can make a new post for everyone to help you fix this problem(Because this question strays so far from your original question, one post is better off addressing only one question).
Good Luck.

Hello World Magento Plugin

I'm new to magento & am trying to get a simple plugin working.
When a user adds a product to the basket I'd like magento to display a dialog box with some text in it.
Can anyone provide a link to a guide to this or something similar?
I'm using magento2
Thanks
EDIT:
Thanks for that,
I found a tutorial and this is what I have atm, the plugin looks to be enabled as far as I can see.
What I'm trying to get to working is a message to display when a user adds a product to the cart.
Currently the text on the add to cart button changes to 'Adding..' and hangs. How can I debug this?
Thanks for that,
I found a tutorial and this is what I have atm, the plugin looks to be enabled as far as I can see.
What I'm trying to get to working is a message to display when a user adds a product to the cart.
Currently the text on the add to cart button changes to 'Adding..' and hangs. How can I debug this or fix this?
<?php
namespace Acme\AddToCartMessage\Plugin;
use Magento\Checkout\Model\Cart\CartInterface;
use Magento\Framework\Message\ManagerInterface as MessageManager;
class AddToCartMessage{
private $messageManager;
public fucntion __construct(MessageManager $messageManager){
$this->messageManager = $messageManager;
}
public afterAddProduct(\Magento\Checkout\Model\Cart\CartInterface $cart, $result){
$this->messageManager->addNoticeMessage('Testing');
return result;
}
}
There are actually a couple ways to achieve what you're trying to do. The cleanest way would be to utilize event observers. Here's a link to their documentation - Magento 2 - Events and Observers.
A quick overview:
Create an etc/frontend/events.xml file.
Create an observer for the checkout_cart_add_product_complete event.
Inject the \Magento\Framework\Message\ManagerInterface into your observer class.
public function __construct (
\Magento\Framework\Message\ManagerInterface $messageManager
) {
$this->_messageManager = $messageManager;
}
The message manager will display a notification after the item has been added. To show a popup, you should look into M2's JS components - JavaScript Developer Guide.

Magento - import - Get an error just after clic on save and continue to edit

My data was move from another server by the team who host my website ( www.whc.ca) and now when i go in the section:
system -> import/export -> CommerceExtension
when i open a import with out add any file just clicking save and continue i get this message:
Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).
I don't get this from any other files in the system -> import/export
I talk with the guy how program this extension and he said that there is nothing in his program that bring this error.
The guys who doing the technical support on WHC do not know how to fix it. It was fix once when i was on the other server but there was no note about how it was fix.
some one made this for me: http://djinncomics.com/phpinfo.php
Can some one know what can cause that or where to look? true the Cpanel i already configure the limit and i modify the php file ether. nothing seem affect this error message.
I assume your import/export extension is certainly overloading some of Magento classes. I got the same error today and checked the code, here is what appear to be the problem, in file app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php :
/**
* Save profile action
*/
public function saveAction()
{
if ($data = $this->getRequest()->getPost()) {
...actions...
}
else {
Mage::getSingleton('adminhtml/session')->addError(
$this->__('Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).')
);
$this->_redirect('*/*');
}
}
When you try to save an import/export profile and don't change any param, Magento will automatically assume that you have a problem with your server configuration, which is not the case.

Magento : How to hide the default Store View code from the url

The site has 2 languages: English and French, represented by 2 store views. French is the default one. For our SEO efforts we need to have the following urls:
French - http://www.domain.com/category/product
English - http://www.domain.com/en/category/product
System -> Configuration -> Web -> Add Store Codes to URL is the all or nothing setting. We just need to turn it off for the default store only.
I’ve done a lot of searching through the forums and wiki but there’s nothing on the subject.
Please any sugestions?
Finnaly i solved this magic probleme , i hope that's save others persone here is the details :
1- Download the zip existe in this page : https://github.com/Knectar/Magento-Store-Codes
2- unzip the file and put the folder called "Knectar" in {app/code/community/} and Knectar_Storecodes.xml file in {app/etc/modules}
3- In your backoffice go to "System > Tools > Compilation" and click the rebuild button
4- always in backoffice got to "System > Configuration > Web > URL options" and set the attribute "and default store view" to No and save the configuration
5- Clear your cach magento and enjoy your application :) .
I had the same problem and I have developed an extension for that.
It is available on GitHub: https://github.com/jreinke/magento-hide-default-store-code
I didn't find a quick solution to your problem, but I see that's possible through 2 steps :
1 / Using the advise commented by #user3154108 and trying this tip https://magento.stackexchange.com/questions/8126/store-code-in-url-for-every-store-view-except-for-default
2 / For SEO SITEMAP, it's possible to override the following file
app/code/core/Mage/Sitemap/Model/Sitemap.php
public function generateXml()
{
...
}
and replace the default store code by NULL.
For more details try to look at this post : http://alanstorm.com/generating_google_sitemaps_in_magento
I was having the same problem and I had already selected to not show store code in url in the config. I also didn't want to install an extension just to handle something this minor. Here's my EASY solution:
Copy app/code/core/Mage/Catalog/Block/Widget/Link.php to app/code/local/Mage/Catalog/Block/Widget/Link.php
Search for (line 91 in Magento 1.7.x / line 100 in Magento 1.9.x)
$this->_href = $this->_href . $symbol . "___store=" . $store->getCode();
And modify to
$this->_href = $this->_href;
Upload and save your changes and you'll now not have your widget (dynamically) inserted links getting appended with ?___store=default.
Credit: DesignHaven
Under System -> Configuration -> Web -> URL Options you
change "Add Store Code to Urls" to "NO" as on the attached screenshot

Resources