View Issue Details

IDProjectCategoryView StatusLast Update
0002676OXID eShop (all versions)1.01. Products (product, categories, manufacturer, promotions etc.)public2012-12-07 14:28
Reporterasarturas Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.4.5 revision 31315 
Fixed in Version4.5.3 revision 39087 
Summary0002676: Sometimes oxArticle::getLink() method returns wrong url for variant
DescriptionSee steps for reproduce.
Steps To Reproduce1. Load product variant with language=1
2. Print variant url using oxArticle::getLink() method (without params)
3. Load the same variant in another variable with language=0
4. Print out this new variable url using oxArticle::getLink() method (without params)

Expected results:
First print (Step.2) returns url for language=1,
Second print (Step.4) returns url for language=0.

What happens instead:
First print (Step.2) returns url for language=1,
Second print (Step.4) also returns url for language=1.

Sample code to reproduce bug:

// test urls - en
$oArticleEn = oxNew('oxarticle');
$oArticleEn->setLanguage(1);
$oArticleEn->Load('%ARTICLE-VARIANT-ID%');
var_dump($oArticleEn->oxarticles__oxtitle->value, $oArticleEn->getLink());
// test urls - de
$oArticleDe = oxNew('oxarticle');
$oArticleDe->setLanguage(0);
$oArticleDe->Load('%ARTICLE-VARIANT-ID%');
var_dump($oArticleDe->oxarticles__oxtitle->value, $oArticleDe->getLink());
die();
Additional InformationPossible hotfix:
In sample code instead of
$oArticleDe->getLink();
use
$oArticleDe->getLink($oArticleDe->getLanguage());
TagsProducts
Theme
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0002673 resolvedArunas Parent articles of variants should be loaded in current language of variant 

Activities

asarturas

2011-04-01 10:16

reporter   ~0004292

P.S. hotfix of issue 0002673 (https://bugs.oxid-esales.com/view.php?id=2673) does not fixes that.

asarturas

2011-04-01 19:54

reporter   ~0004306

This issue is related to 0002673
If you do the same 4 steps, which are described above, but print long description instead of link, then you'll see that behaviour is the same for this field.
The problem there is because in oxArticle::getParentArticle() method it caches loaded parents in array, which values are distinguished only by parent_id, so if there is already parent loaded with language=1 and same parent with language=0 is required for this variant, it will not be loaded from db, but already cached parent with language=1 will be returned.

birute_meilutyte

2011-05-06 13:22

reporter   ~0004499

@developers: check from source code side if such issue still exist and if offered solution is correct.