View Issue Details

IDProjectCategoryView StatusLast Update
0002842OXID eShop (all versions)2. ----- eShop backend (admin) -----public2011-05-31 09:46
ReporterMoehlis 
PriorityurgentSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.0 revision 34568 
Target VersionFixed in Version4.5.1 revision 38045 
Summary0002842: wrong shopid in admin
DescriptionUsing $this->getConfig()->getShopId() in admin will return 1 if the "shp" parameter is not present in post/get data.

This leads to errors in saving data because the data is saved in the wrong shop.
Steps To Reproduce- create additional subshop with an individual url
- create own admin view and template with a form to submit, set the fnc to some method within your view
- within the method, output $this->getConfig()->getShopId()
- submit the form
--> in all subshops you will get the id 1

-> redo these steps after deleting the individual url for your subshop and you will magically get the correct shopid
Additional InformationThats because the form submitted doesnt include the "shp" parameter which is set within oxviewconfig.php:getHiddenSid()

If the shp parameter will be put into your form as hidden param is determined by oxconfig.php:mustAddShopIdToRequest().
And there is the problem. If the shop has its own url, the shp parameter isn't necessary what is absolutely right - in the frontend!

Possible bugfix, checking for admin:
public function mustAddShopIdToRequest()
{
    $blMustAdd = false;
    //in case shop has no separate URL and is not base shop - adding shop id to url
    if ( $this->isAdmin() || ($this->getShopId() > 1 && !$this->getConfigParam( 'sMallShopURL' )) ) {
        $blMustAdd = true;
    }
    return $blMustAdd;
}
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0002925 resolveddainius.bigelis Changes in CMS Pages of a subshop are saved for all Subshops. 
has duplicate 0002989 closedbirute_meilutyte shopid gets lost in forms (using $oViewConf->getHiddenSid()) 
related to 0002875 resolvedvilma_liorensaityte oxConfig::mustAddShopIdToRequest() does not check admin state (EE only) 

Activities

birute_meilutyte

2011-05-06 09:56

reporter   ~0004490

@developers: check from source code side if described problem still exist and if offered solution is useful

frank

2011-05-20 05:41

reporter   ~0004624

Last edited: 2011-05-20 05:43

View 2 revisions

No idea why you didn't have more trouble. You actually can't create any objects (articles, CMS snippets, languages) - tested with individual sub-shops. So this is the severiy block, not minor.

I have a minimal different solution:

if ($this->getShopId() > 1 && (!$this->getConfigParam( 'sMallShopURL' ) || $this->isAdmin()) ) {


Please make 100% sure, that this is asap fixed in 4.5.1

Moehlis

2011-05-24 09:33

reporter   ~0004651

Damn, you're right. I didn't checked the oxid standard cases because it was unbelievable that the 4.5 was never tested for its mall functionality :-O