SOLVED -Syntax error, unrecognized expression #mprices[product_price_publish_up]

Started by Sicos, March 22, 2015, 19:28:49 PM

Previous topic - Next topic

edthenet

Quote from: Milbo on March 25, 2015, 01:47:10 AM
http://dev.virtuemart.net/projects/virtuemart/files

try 3.0.6.4

Thanks i have installed the update and now the buttons work again.
But i must say it became very slow. Saving takes about 5 seconds. Before this was miliseconds

Frans D

Quote from: Milbo on March 25, 2015, 01:47:10 AM
http://dev.virtuemart.net/projects/virtuemart/files

try 3.0.6.4

I tried 3.0.6.4 and it solves the "not being able to save new products" problem.
However it seems to be conflicting with Jquery Easy, as after updating to 3.0.6.4 my revolution slider and (template) cart module went blank.


Studio 42

HI,
Other french user have same issu.

Of course the php function is bad, but
mprices[product_price_publish_up]-' . $this->priceCounter as a ID is bad to.
Simply use
        <td  nowrap>
<?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][]','mprice-product_price_publish_up-' $this->priceCounter); ?>
        </td>
        <td  nowrap>
<?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][]','mprices-product_price_publish_down-' $this->priceCounter); ?>
        </td>


Is the right way to set the ID in this case.

A day someone add a regex because someone add quotes in the ID?

You(MAX) add a fix for something bad, but only for this case.

Solution 1 : make a fix for all case, to prevent all errors, that all newbie can use the api.
Code From Joomla core :
// Remove any duplicate whitespace, and ensure all characters are alphanumeric
$str = preg_replace('/(\s|[^A-Za-z0-9\-])+/', '-', $str);

// Trim dashes at beginning and end of alias
$str = trim($str, '-');


Solution 2 : simply correct the mistake in the ID itself and don't add filters for nothing in the PHP function.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

samlf3rd

Quote from: Milbo on March 24, 2015, 12:27:39 PM
Quote from: Freddo on March 23, 2015, 22:59:04 PM
error because id has to be unique...

The id is unique, but thank you very much for the hint, the real problem was the ID of the field, which used as fallback just the name and the new js has problems to handle [] in the id. Please try the attached file (renamed) at /administrator/components/com_virtuemart/helpers

This file helped me on VM 3.0.6.2-I couldn't save either in Chrome, Firefox, Cleared Cache, purge expired, reinstalled VM, you name it I read through all the forums this fixed it!

Studio 42

hi,
Quote from: Milbo on March 31, 2015, 01:31:56 AM
Ehrm Patrick, that is solved since almost a week in the svn and also already provided as installer http://dev.virtuemart.net/projects/virtuemart/files
I know, it's fixed, but make a real choice not a mix.
Or add a regex or simply fix the bad IDS.
All two fix are incorrect, your or this by users.
Why :
The fix by users are not a correct ID.
The fix by you only fix the ID in this case.

If someone (a developper) make a mistake on setting the ID name using another char, this is not fixed on your changes(quote, single quotes ....)

sonickev

Quote from: Sicos on March 23, 2015, 18:46:32 PM
A fix for this problem

Open the file --> /administrator/components/com_virtuemart/views/product/tmpl/product_edit_price.php

Change these lines:

        <td  nowrap>
         <?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][]'); ?>
        </td>
        <td  nowrap>
         <?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][]'); ?>
        </td>

To:

It's on line 144 and 147, make sure that you add the 0 between the brackets... this fixes the problem.

        <td  nowrap>
         <?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][0]'); ?>
        </td>
        <td  nowrap>
         <?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][0]'); ?>
        </td>

Greetings,
Kees van Spelde

In my installation...with Joomla 3.4.1 and VM 3.0.6.4, this worked...thank you!

Milbo

yeh it works for you, if you have only one price.

Patrick, the use of [] in the id is valid html5 !
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

and yes, the real solution is a class, which keeps all your ids and ensures that all of them are unique.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

skyglide

Good afternoon,
Thanks for this topic and for this new Virtuemart version 3.0.6.4. I can't save my product modification since I update Jommla to 3.4.1
Can I use it on my website (localhost and soon I hope online)? Is it a production/stable version?
Do I have just to download >  com_virtuemart.3.0.6.4.zip and install it?
Why this version is not proposed on the download section of virtuemart.net ? > http://virtuemart.net/download

Thanks in advance for your reply

Best R
Joomla 3.4.1 / Virtuemart 3.0.7 /  PHP 5.5.22

PHP exécuté sur    SunOS localhost 5.10 Generic_142901-13 i86pc
Version de la base de données    5.5.42-log
Serveur web    Apache/2.2.29 (Unix)

Milbo

Because it is an interim version, which I had to release due the bug in joomla 3.4.1. So we had not the time to check anything in vm3.0.6.4, the vm3.0.7 is on the way. We need live tests of it and release than officially the vm3.0.8
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

There can be a problem with the OPC and more than one choice for shipment/payment
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

Quote from: Milbo on April 01, 2015, 14:23:01 PM
yeh it works for you, if you have only one price.

Patrick, the use of [] in the id is valid html5 !

... but this give javascript errors and was the main problem.

I don't understand why you cannot simple say, thanks this is the right solution, i fix the bug ?

In all case, dynamic adding a new price, must always regenerate a new ID, i don't have look in the internal javascript, but if this not work, on cloning the DOM Node you have to set a new ID each time in JS