Jump to content
Nimmit

AJAX Attribute Manager support

Recommended Posts

The only small issue is how to get the price inkl to show up after update.

Now the field is empty.

 

What kind of update? And which gross field (the one for the new attribute or the fields in the table)?

 

There's a small problem here: I'm working on an osC fork with heavy changes to the admin section (for instance, my version of the Attribute Manager isn't called from categories.php but from a separate products_edit script) and I'm rewriting the Attribute Manager to fit my needs (like entering gross values, a WYSIWYG approach to the sort order and some bugfixes). This simply means that you have to be a bit more specific about an error so that I can figure out exactly what you did and why the script didn't do what it was supposed to do. :)

 

On that note:

 

Version 2.7 DOES NOT WORK for new products. It will forget all entered prices and may add some bogus attributes.

 

BUGFIX:

 

attributeManagerUpdateAtomic.inc.php

Replace "option_value_price" with "price" (without the quotes).

 

attributeManagerAtomic.class.php

Replace "option_value_price" with "price" (without the quotes). Now prices will be updated.

Replace "options_values_id" with "option_value_id" (without the quotes). Now it's possible to remove an option value.

Replace "options_id" with "option_id" (without the quotes). Now it's possible to remove an option.

In function update($get) (line 201) replace

$this->arrSessionVar[] = $getArray;

with

	foreach($this->arrSessionVar as $id => $res) {
  if(($res['option_id'] == $getArray['option_id']) && ($res['option_value_id'] == $getArray['option_value_id'])) {
	$this->arrSessionVar[$id] = $getArray;
	break;
  }
}

(that looks like a copy & paste gone wrong)

Share this post


Link to post
Share on other sites

Hi

Sorry.

 

What happens is that when I write the price (gross or net) it calculate the other perfect. Then I save and the correct price(inklusive tax) is shown in the shops dropdown menu for attributes.

But when I go back into edit on the product and look at the price, the inklusive tax field is empty and the ex tax field show the price ex tax(as it should).

 

My question is then how to get the field to show the price when I go back in to edit.

I had a look at my code, and it is exact as you wrote in your last post.

 

Hope my explenation was better this time.

Share this post


Link to post
Share on other sites

Hi,

 

I tried to put this in my site but it did not work. I had SPAW for the text which uses prototype also. I got rid of that and attributes works in firefox but not IE now. Any ideas?

 

I thought about rewriting the ajax stuff to remove prototype but I did not know where it extends to. Does prototype just do the xml http request or does it do more? It looks great but I cant get the thing to work.

 

Thanks,

 

Martin

Share this post


Link to post
Share on other sites
Hope my explenation was better this time.

It shure was, but I still don't know what went wrong.

 

Let's try this:

 

In attributeManager.js change the function amUpdateContent so that it looks like this:

 

function amUpdateContent(id) {
getElement(amRequester.getTarget()).innerHTML = amRequester.getText();
amRestoreDisplayState();
amUpdAllGross();
}

(in other words: add amUpdAllGross(); to it)

 

If that also doesn't work, then we have to take a closer look at what happens behind the scenes. I recommend using Firefox with the Firebug add-on - a f*cking great tool when testing javascript/AJAX. But hopefully it works. :)

Share this post


Link to post
Share on other sites
Hi

Sorry, still didn't work.

How do I test it with firebug?

 

Thanks for helping me.

That's weird.

 

Anyway, about Firebug:

 

Install from here: https://addons.mozilla.org/en-US/firefox/addon/1843

 

After that, the first thing you want to do is to disable it (Tools/Firebug/Disable Firebug). Firebug is a great tool for testing and developing, but it's also time and memory consuming and may even crash Firefox when used on really buggy sites. That's why you should enable it only for the sites you're actually developing. After you've disabled Firebug, the Firebug icon on the right of your status bar should be grey.

 

Next, go to your site. Hit F12 to open Firebug and click on "Enable Firebug for this web site". Now the Firebug icon should be green (or red).

 

Then call the page which has the error.

 

In the Firebug window, there's a console tab (should be active on default) which shows javascript errors (in red) and AJAX requests.

 

If there are any javascript errors, you can try to fix them by yourself or post them here.

 

If there aren't, there should be at least one line which starts with GET. That's the AJAX request which created the attributes table. Click on it. Now you'll see three tabs, Params, Headers and Response. Click on Params and copy the tab's content to post it here. Then right-click on Response, choose Copy Response Body and paste it to your post (please use a Insert Special Item - CODEBOX for this).

 

Then we'll see...

Share this post


Link to post
Share on other sites

Hi

I tried it, but could not find the get etc.

The only error I got was for fck editor language.

 

If you would like, you can send me a msg and I can give you an admin accont.

The admin is in norwegian, but its quite logic where to go to edit a product.

Share this post


Link to post
Share on other sites
Hi

I tried it, but could not find the get etc.

 

As I said, weird. Because...

 

IF

you can see the attribute manager on your page

AND

Firebug is enabled (the Firebug icon on the right of the browser's status bar is green or red, not gray)

AND

Show XMLHttpRequests is checked in Firebug's console options (open Firebug, click on the Console tab at the left, then on Options on the right)

THEN

there has to be a GET entry in Firebug's console. That GET entry shows the XMLHttpRequest needed to create the attribute manager. Without it, you simply couldn't see the attribute manager (it would still be the empty div from attributeManagerPlaceHolder.inc.php).

 

So, please check again. Keep in mind: Knowing how to use Firebug may help you in the future, because there's always another update, another contrib, another bug.

Share this post


Link to post
Share on other sites

Hi

Got some help to get the firebug to work.

Here is the get

 

pageAction	new_product
products_id	423
sdAdminID	3854260f1befbc0b8b12fa6181acbf9a
taxRate	25

 

And the Response

<div id="topBar"><table width="100%" cellpadding="0" cellspacing="0">

<tr>

	<td>	

	</td>

	<td align="right">

				<div  style="padding:5px 3px 5px 0px">

			<select name="template_drop" id="template_drop" style="margin-bottom:3px"><option value="0" SELECTED

>-- Valg --</option></select>					 

				<input type="image" src="attributeManager/images/icon_load.png" onClick="return customTemplatePrompt

('loadTemplate');" border="0" title="Bruk det valgte templatet" />

				 

				<input type="image" src="attributeManager/images/icon_save.png" onClick="return customPrompt('saveTemplate'

);" border="0" title="Lagre det eksisterende templatet" />

				 

				<input type="image" src="attributeManager/images/icon_rename.png" onClick="return customTemplatePrompt

('renameTemplate');" border="0" title="Gi det valgte templatet nytt navn." />

				 

				<input type="image" src="attributeManager/images/icon_delete.png" onClick="return customTemplatePrompt

('deleteTemplate');" border="0" title="Slett det valgte templatet." />

				 

		</div>

					</td>

</tr>

</table>

</div><div id="attributeManagerAll"><div id="currentAttributes">	<table width="100%" border="0" cellspacing

="0" cellpadding="3">	

	<tr class="header">

		<td width="50" align="center">

			<input type="image" src="attributeManager/images/icon_plus.gif" onClick="return amShowHideAllOptionValues

([1,3],true);" border="0" />

			 

			<input type="image" src="attributeManager/images/icon_minus.gif" onClick="return amShowHideAllOptionValues

([1,3],false);" border="0" />

		</td>

		<td>

			Produkt Alternativer<span style="font-size: 11px; color: red;">  Trykk på + tegnet for

å se alle attributtene</span>

		</td>



		<td align="right">

			<span style="margin-right:40px"></span>

		</td>

	</tr>



			<tr class="option">

			<td align="center">

			<input type="image" border="0" id="show_hide_1" src="attributeManager/images/icon_plus.gif" onClick

="return amShowHideOptionsValues(1);" />



			</td>

			<td>

				Farge (1)				</td>



			<td align="right">

				<select name="new_option_value_1" style="margin:3px 0px 3px 0px;" id="new_option_value_1"><option

value="4">R?d</option><option value="5">Sort</option></select>						<input type="image" src="attributeManager

/images/icon_add.png" value="Add" border="0" onClick="return amAddOptionValueToProduct('1');" title="Legger

til attributtet fra nedtrekksmenyen til Farge alternativet. " />

					<input type="image" title="Lag et nytt attributt som ikke eksisterer i nedtrekksmenyen til Farge

." border="0" src="attributeManager/images/icon_add_new.png" onClick="return customPrompt('amAddNewOptionValueToProduct'

,'option_id:1|option_name:Farge');" />

					<input type="image" border="0" onClick="return customPrompt('amRemoveOptionFromProduct','option_id

:1|option_name:Farge');" src="attributeManager/images/icon_delete.png" title="Sletter produktalternativet

Farge og de 1 attributtene som tilhører dette alternativet." />

			</td>

		</tr>





		<tr class="optionValue" id="trOptionsValues_1" style="display:none" >

			<td align="center">

				<img src="attributeManager/images/icon_arrow.gif" />

			</td>

			<td>

				Bl				</td>

			<td align="right">

			    <span style="font-size:9px; color:black;"> prefix     pris m/mva

    pris u/mva    rekkefølge      

;                 

; </span><br>

				<span style="margin-right:41px;">

					<select name="prefix" id="prefix_2" style="margin:3px 0px 3px 0px;" onChange="return amUpdate('1'

,'2');"><option value=""></option><option value="%2B" SELECTED>+</option><option value="-">-</option

></select>						<input type="text" name="price_gross_2"  style="margin:3px 0px 3px 0px;" id="price_gross_2"

size="7" onKeyUp="amUpdNet('2')" onChange="return amUpdate('1','2');"> <input type="text" name="price_2"

value="40.0000"  style="margin:3px 0px 3px 0px;" id="price_2" size="7" onKeyUp="amUpdGross('2')" onChange

="return amUpdate('1','2');">						<input type="text" name="sortOrder_2" value="0"  style="margin:3px

0px 3px 0px;" id="sortOrder_2" size="7" onChange="return amUpdate('1','2');">					</span>

				<input type="image" border="0" onClick="return customPrompt('amRemoveOptionValueFromProduct','option_id

:1|option_value_id:2|option_value_name:Bl');" src="attributeManager/images/icon_delete.png" title="Sletter

attributtet Bl fra produktalternativet Farge." />

								</td>

		</tr>

			<tr class="option">

			<td align="center">

			<input type="image" border="0" id="show_hide_3" src="attributeManager/images/icon_plus.gif" onClick

="return amShowHideOptionsValues(3);" />



			</td>

			<td>

				Test (1)				</td>



			<td align="right">

				<select name="new_option_value_3" style="margin:3px 0px 3px 0px;" id="new_option_value_3"><option

value="0">----</option></select>						<input type="image" src="attributeManager/images/icon_add.png"

value="Add" border="0" onClick="return amAddOptionValueToProduct('3');" title="Legger til attributtet

fra nedtrekksmenyen til Test alternativet. " />

					<input type="image" title="Lag et nytt attributt som ikke eksisterer i nedtrekksmenyen til Test

." border="0" src="attributeManager/images/icon_add_new.png" onClick="return customPrompt('amAddNewOptionValueToProduct'

,'option_id:3|option_name:Test');" />

					<input type="image" border="0" onClick="return customPrompt('amRemoveOptionFromProduct','option_id

:3|option_name:Test');" src="attributeManager/images/icon_delete.png" title="Sletter produktalternativet

Test og de 1 attributtene som tilhører dette alternativet." />

			</td>

		</tr>





		<tr class="optionValue" id="trOptionsValues_3" style="display:none" >

			<td align="center">

				<img src="attributeManager/images/icon_arrow.gif" />

			</td>

			<td>

				dyr				</td>

			<td align="right">

			    <span style="font-size:9px; color:black;"> prefix     pris m/mva

    pris u/mva    rekkefølge      

;                 

; </span><br>

				<span style="margin-right:41px;">

					<select name="prefix" id="prefix_8" style="margin:3px 0px 3px 0px;" onChange="return amUpdate('3'

,'8');"><option value="" SELECTED></option><option value="%2B">+</option><option value="-">-</option

></select>						<input type="text" name="price_gross_8"  style="margin:3px 0px 3px 0px;" id="price_gross_8"

size="7" onKeyUp="amUpdNet('8')" onChange="return amUpdate('3','8');"> <input type="text" name="price_8"

value="0.0000"  style="margin:3px 0px 3px 0px;" id="price_8" size="7" onKeyUp="amUpdGross('8')" onChange

="return amUpdate('3','8');">						<input type="text" name="sortOrder_8" value="0"  style="margin:3px

0px 3px 0px;" id="sortOrder_8" size="7" onChange="return amUpdate('3','8');">					</span>

				<input type="image" border="0" onClick="return customPrompt('amRemoveOptionValueFromProduct','option_id

:3|option_value_id:8|option_value_name:dyr');" src="attributeManager/images/icon_delete.png" title="Sletter

attributtet dyr fra produktalternativet Test." />

								</td>

		</tr>

	</table>

</div><div id="newAttribute">	<table border="0"  cellpadding="3">

	<tr>

		<td colspan="5"><span style="font-size:13px; color:black; font-weight:bold;">Lag et nytt produktalternativ

</span></td>

	</tr>

	<tr>

		<td align="right" valign="top">

			Produktalternativ: <select name="optionDropDown" id="optionDropDown" onChange="return amUpdateNewOptionValue

(this.value);"><option value="0">St?rrelse</option><option value="2" SELECTED>Størrelse</option></select

>				<div class="optionValueAddDelete">

				 

				<input border="0"  type="image" src="attributeManager/images/icon_add_new.png" onClick="return customPrompt

('amAddOption');" title="Lag et nytt produktalternativ." />



			</div>

		</td>

		<td align="right" valign="top">

			Attributt: <select name="optionValueDropDown" id="optionValueDropDown"><option value="7">large</option

><option value="9">medium</option><option value="6">small</option></select>				<div class="optionValueAddDelete"

>

				 

				<input border="0" type="image" src="attributeManager/images/icon_add_new.png" onClick="return customPrompt

('amAddOptionValue');" title="Lag et nytt attributt." />

			</div>

		</td>



		<td valign="top">

			<input type="image" src="attributeManager/images/icon_add.png" value="Add" onClick="return amAddAttributeToProduct

();" title="Legger til attributtet til produktet." border="0"  />

		</td>

	</tr>

</table>

</div></div>

Share this post


Link to post
Share on other sites
Hi

Got some help to get the firebug to work.

Here is the get

 

Thanks, I can see clearer now (well, at least a little bit).

 

Is it possible that you've changed the error reporting level in admin/aplication_top.php (right at the top of the script) to something different than this?

 error_reporting(E_ALL & ~E_NOTICE);

If so, then change it back for the time you're making changes to your site. We want to see PHP errors (especially warnings).

 

The get data you've posted was very helpful. It shows that the params are correct, but the response isn't. More precisely. there are some things missing in the response:

 

The fields to enter a price (and a sort order) for a new attribute at the bottom of the page, called newPrice, newPrice_gross and newSort. Unfortunately, the newPrice and newPrice_gross fields are needed in the javascript amUpdAllGross() function, which should lead to a javascipt error (something like ... has no properties).

 

The value for the _gross input fields is missing. It is set by

tep_round(tep_add_tax($optionValueInfo['price'],$_GET['taxRate'],true),4)

And that's really strange. Because of the way tep_draw_input_field and tep_round work, it should be there, no matter what's inside tep_round(). Except something inside generates a PHP warning - that's why I was asking about the error reporting level you're using. But don't waste your time with this bug. Just replace the tep_round(...) code shown above with a simple '' so that you get something like

tep_draw_input_field("price_gross_$optionValueId",'','style=...

If we get amUpdAllGross to work, we don't need to calculate the tax here any longer.

 

So, let's find out why the newPrice and newPrice_gross fields aren't there!

Share this post


Link to post
Share on other sites

Hi

I got an error saying.

 

There was an error while retrieving the url: internal server error !

 

So it's the tep_round(tep_add_tax($optionValueInfo['price'],$_GET['taxRate'],true),4) that's supposed to write the price in the incl price in the field?

Share this post


Link to post
Share on other sites

Hi again,

 

I sort of worked out my SPAW conflict in that I put the attribute manager on the preview page.

 

I got it to come up by changing a few if($_GET['action']== 's to include this page.

 

I have added the new product fix and the sprint_f typo and got the sort order to work but...

 

It just will not save the attributes! It was only displaying one at a time but I got it to list several but they are not there when i save and go back. If there are attributes set it reads them and then deletes them when I save. I looked through the code and took attributemanagerupdateatomic.inc.php to be the file called when the attributes are saved to the database but I could not see anywhere calling this page except in the category.php file. I also have attribute sorter and copier installed so I wondered if the two might be conflicting.

 

Anyone got any ideas?

 

Thanks,

 

Martin

Share this post


Link to post
Share on other sites

Hi,

 

Solved my own problem.

 

Next one - I did what it said a few posts back about new products not having the attributes saved for new products but it did not work.

 

if I try to enter more than one option it just overwrites the first option rather than putting in a new one. My best guess is in an addAttributeToProduct() function somewhere maybe attributemanagerinstant.class.php but I a guessing.

 

This is a really annoying bug because this is a great mod but it makes it pointless if you have to go backwards and forwards.

 

What is the difference between a new product and an old one in terms of where the data is stored? Which files are involved?

 

Maybe I can figure this out but if anyone else has an idea I would be very gratefull

 

Martin

Share this post


Link to post
Share on other sites

I am going to make this easy for you guys.

I have a problem with my installation, here are pictures.

I followed the directions perfectly.

Maybe I missed something to install?

Is it possible to just copy somebody elses categories.php? if so could I get an upload?

 

here are links to pictures of the error, one wtih firebug and the other just the site.

 

error.gif and error2.gif

 

 

also I can send anybody my categories.php file, its a little to big to just post up on here huh? lol.

Thanks in advance!

Share this post


Link to post
Share on other sites

I love this contribution. But if I want my option value to be in a certain order, I have to add one value, save, go back in by edit and add another. And it will put my values in order. eg: One Size Fits All above my One Size Fits All - Plus. Even having to do this is easier than the original way through product attributes.

 

If I try to use a template that I've made, I get:

Fatal error: Call to undefined function: sprint_f() in /var/www/html/catalog/admin/attributeManager/includes/attributeManagerPrompts.inc.php on line 164

 

If I try to delete a selection (like a color), I get:

Fatal error: Call to undefined function: sprint_f() in /var/www/html/catalog/admin/attributeManager/includes/attributeManagerPrompts.inc.php on line 147

 

But I can still delete it the old fashion way, through Product Attributes.

 

I had my web host company add this contribution right before they left for the weekend. I don't know if maybe they missed something or maybe they added an old version.

 

Please help.

 

Starnene

Share this post


Link to post
Share on other sites

Hi, this one is pretty easy to fix.

 

Find the ...prompts file. I think it is in includes but maybe in classes. Change every sprint_f() to sprintf() and it will be fixed.

 

Martin

Share this post


Link to post
Share on other sites
Next one - I did what it said a few posts back about new products not having the attributes saved for new products but it did not work.

Are you talking about the bugfixes I've posted?

 

What is the difference between a new product and an old one in terms of where the data is stored? Which files are involved?

Attribute Manager has two modes, instant and atomic. The difference between them is when the database is updated. Both modes will update the database instantly whenever you add a new option or option value (that is, whenever you're prompted for a name). In instant mode, which is the default when editing an existing product, all changes to the product's attributes (adding, removing, changing the price or sort order) will also update the database instantly. In atomic mode, used for new products, the database isn't updated until you actually create the product (this happens in attributeManagerUpdateAtomic.inc.php). Instead, the data is stored in a session variable.

 

For testing:

 

Add to the end of attributeManager.php

<pre>
<?php print_r($_SESSION); ?>
</pre>

Completely breaks the design, but at least you can see what's going on. If you're using Firebug, it's a better idea to add

<!--
<?php print_r($_SESSION); ?>
-->

and to examine the AJAX responses.

 

The critical functions are addAttributeToProduct() (adds a new attribute to the product/session var) and update() (updates the session var for an existing attribute) in attributeManagerAtomic.class.php and the code in attributeManagerUpdateAtomic.inc.php (uses the session var to update the database).

Share this post


Link to post
Share on other sites

Does anybody know why this contribution would stop working all of the sudden. It was working fine, but now when I go to a product, the ajax windows does not appear. Any suggestions?? Thanks!!

Share this post


Link to post
Share on other sites

OK,

 

I get:

 

[AM_SESSION_TEMPLATES_INSTALL_CHECKED] => 1
[0] => 1
[am_session_var] => Array
	(
		[] => Array
			(
				[option_id] => 4
				[option_value_id] => 3
			)

	)

For the $_session.

 

If try to add another value to this option or another option it just chnges to show the new value. The clue I think is that teh array is [] where $id should give an index I think.

 

Any idea how $id is arrived at? What about $res?

 

Does anyone have a working version of attributeManagerAtomic.class.php or could someone show me what the array should look like when it works?

 

Thanks,

 

Martin

Share this post


Link to post
Share on other sites

I was receiving the following error for the longest time and could not figure it out:

 

FATAL ERROR: register_globals is disabled in php.ini, please enable it!

 

I put:

 

"register_globals = on"

 

(without the quotes)

 

into php.ini and placed it in /admin/ but I still received the error. This drove me crazy for months.

 

The problem is, you need to place the php.ini into all of the directories under /admin/attributeManager/

 

If you only place the php.ini into the /admin/ or /attributeManager/ directories it WILL NOT WORK.

 

Place the php.ini (with the code above) into the following directories:

 

/admin/

/admin/attributeManager/

/admin/attributeManager/classes

/admin/attributeManager/css

/admin/attributeManager/images

/admin/attributeManager/includes

/admin/attributeManager/javascript

/admin/attributeManager/languages

 

Some of these might be unnecessary but it won't hurt anything.

 

To double check if register_globals.php is on simply make a phpinfo() file and place it in each of those directories to test it. Remember, the php.ini ONLY turns register_globals on for the directory that the php file is IN. Not for any of the subdirectories.

 

Perhaps this should be included in the install instructions.

 

Thanks for a great contrib.

Share this post


Link to post
Share on other sites
If try to add another value to this option or another option it just chnges to show the new value. The clue I think is that teh array is [] where $id should give an index I think.

Sounds like a good clue. It should read [0] for the first entry.

 

Any idea how $id is arrived at? What about $res?

$res? There shouldn't be a $res in addAttributeToProduct. On that note, can you post your version of function addAttributeToProduct (from Atomic.class)? I think that's the easiest way to fix this.

 

And while we're at it, here's another bugfix, this time for attributeManagerConfig.class.php.

 

Delete line 55

		/** 
	 * Install templates if not already done so 
	 */
	$this->installTemplates();

Delete line 69

		/**
	 * Install the sort order tables if they dont already exist
	 */
	$this->installSortOrder();

Add to the end of function attributeManagerConfig (line 97 before the deletions):

	/**
 * Install templates and sort order if they dont already exist
 */
$this->installTemplates();
$this->installSortOrder();

 

The reason for this is that both install functions use values which are set after they've been called in the original. As a result, you can see [AM_SESSION_TEMPLATES_INSTALL_CHECKED] and [0] as the names of the session vars, although those name should actually be [am_templates_checked] and [am_sort_order_checked]. The funny thing is that it actually works as expected because on another error:

 

Replace (line 120 before the changes)

amSessionRegister('AM_SESSION_TEMPLATES_INSTALL_CHECKED',true);

with

amSessionRegister($this->getValue('AM_SESSION_TEMPLATES_INSTALL_CHECKED'),true);

Share this post


Link to post
Share on other sites

Here is my addattributetoproduct function from atomic.class:

 

function addAttributeToProduct($get) {
 if(isset($get['option_id']) === true) {
$this->getAndPrepare('option_id', $get, $getArray['option_id']);
 }

 if(isset($get['option_value_id']) === true) {
$this->getAndPrepare('option_value_id', $get, $getArray['option_value_id']);
 }

 if(isset($get['price']) === true) {
$this->getAndPrepare('price', $get, $getArray['price']);
 }

 if(isset($get['prefix']) === true) {
$this->getAndPrepare('prefix', $get, $getArray['prefix']);
 }

 if(isset($get['sortOrder']) === true) {
$this->getAndPrepare('sortOrder', $get, $getArray['sortOrder']);
 }

//	echo '<br><br>Array arrSessionVar:: <br><br>';
//	print_r($getArray);


 $this->arrSessionVar[$id] = $getArray;
}

 

I think that this is where the $id should give the index. Here is update() which has $res in it:

 

	function update($get) {
	  if(isset($get['option_id']) === true) {
		$this->getAndPrepare('option_id', $get, $getArray['option_id']);
	  }

	  if(isset($get['option_value_id']) === true) {
		$this->getAndPrepare('option_value_id', $get, $getArray['option_value_id']);
	  }

	  if(isset($get['price']) === true) {
		$this->getAndPrepare('price', $get, $getArray['price']);
	  }

	  if(isset($get['prefix']) === true) {
		$this->getAndPrepare('prefix', $get, $getArray['prefix']);
	  }

	  if(isset($get['sortOrder']) === true) {
		$this->getAndPrepare('sortOrder', $get, $getArray['sortOrder']);
	  }

	 foreach($this->arrSessionVar as $id => $res) {
	   if(($res['option_id'] == $getArray['option_id']) && ($res['option_value_id'] == $getArray['option_value_id'])) {
		 $this->arrSessionVar[$id] = $getArray;
		 break;
	   }
	 }

 

My guess is that it is in the foreach part that the index is missed.

 

Martin

Share this post


Link to post
Share on other sites
Here is my addattributetoproduct function from atomic.class:

 

  $this->arrSessionVar[$id] = $getArray;

Replace this with

  $this->arrSessionVar[] = $getArray;

and everything should work fine. [] adds a new element to arrSessionVar (that's what we want), while [$id] replaces element arrSessionVar[''] ('' because $id wasn't set to any value before, so it's null, but since null isn't a valid array key, PHP's automatic type conversion comes into play). [$id] was neither in the bugfix nor in the original version, so I guess you somehow messed that up on your own. Well, shit happens all the time. :)

 

Btw. $id in update() isn't an actual id but just an array index. The actual ids are generated later by the database itself when attributeManagerUpdateAtomic.inc.php inserts the attributes.

Edited by Tawe Luki

Share this post


Link to post
Share on other sites

i have a strage problem, i instaled this contribution and if i use works only wen i save this the all atributes will not savewat i supos to do ?is a problem if i have upgradet the options to use radio and checkbox ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×