Jump to content



Latest News: (loading..)

- - - - -

Firefox conQuery: osC Edit Product


  • Please log in to reply
14 replies to this topic

#1   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 09 May 2005 - 12:31 AM

I've recently started using Firefox in order to be able to customize my browser more easily. Basically I want to go straight into the admin for editing the items/page I'm looking at from the catalog side.

The example below uses the ConQuery Firefox extension in order to add a menu item to rightclick menu.
ConQuery allows you to take pieces from your current webpage and pass this as parameter to another website/webservice. So it has defined interfaces to query google, yahoo, ebay etc There is an online repository with samples.

Installation is easy in 3 steps:
1. Install ConQuery extension
2. Restart firefox
3. Save embedded file as osCeditProduct.cqr in the searchplugins directory under your firefox installation
Now you can further customize the options, but you should already be seeing the oscommerce option under the Conquery menu.

It works well as it opens the page with the passed parameters but there is a glitch.
It is only supposed to show up in the menu when 'products_id' is part of the url string, but it is showing up all the time.
I suspect my regex is not correct, but I'm not sure.
  
Are there any firefox enthousiasts and regex experts outhere that can help ?
If this is solved, I can create some more variants for categories, specials, attributes etc, it's just that I want to avoid cluttering up my menu too much with irrelevant options ...

# Mozilla/osCommerce plug-in by Carine Bruyndoncx (info@calimeross.com)
# osCommerce Edit Product

<search 
   name="osC edit Product"
   description="Edit current product"
   method="GET"
   action="http://[:host]/admin/categories.php"
   category="osCommerce"
   showiftarget="[:url]"
   showif="products_id=(\d+)"
   queryEncoding="utf-8"
   queryCharset="utf-8"
>
<input name="pID" value="[:matched:1]">
<input name="action" value="new_product">

</search>

Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#2   Wendy James

Wendy James
  • Members
  • 4,131 posts
  • Real Name:Wendy James
  • Gender:Female
  • Location:Alabama USA

Posted 09 May 2005 - 06:41 AM

I tried using this and I get errors...

Warning: reset(): Passed variable is not an array or object in /tosite/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /tosite/admin/includes/classes/object_info.php on line 18

It does open the page but there is no information in any of the fields. Would be really cool if this worked though, thanks for trying to make our lives easier!
Wendy James

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

#3   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 09 May 2005 - 07:32 AM

Well this is the error you get on pages that don't have 'products_id=XX' in the URL, thus the reason to only show it in the menu when it would actually be working ...

Any takers ?
Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#4   Wendy James

Wendy James
  • Members
  • 4,131 posts
  • Real Name:Wendy James
  • Gender:Female
  • Location:Alabama USA

Posted 09 May 2005 - 07:47 AM

I am not real smart but I am going to guess that means it should only work when you are on an actual products page?

If that is so, then I still get the error. Maybe it is because of the cname pname thing?
Wendy James

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

#5   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 09 May 2005 - 08:07 AM

yes, that is it in your case.
If you use the SEO contribution, the page url doesn't have the products_id, but the pname parameter.
I'm not 100% familiar with this, but I guess if pname is truely uniquely identifyiing a product in your store, a similar conquery could be made to work in your case too ... [ chemo where are you ]

Edited by bruyndoncx, 09 May 2005 - 08:07 AM.

Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#6   Wendy James

Wendy James
  • Members
  • 4,131 posts
  • Real Name:Wendy James
  • Gender:Female
  • Location:Alabama USA

Posted 09 May 2005 - 08:28 AM

Ok, that makes lots of sense. I am sure you or someone else will figure it all out... again, thank you for helping others! =)
Wendy James

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

#7   Chemo

Chemo
  • Banned
  • 2,486 posts
  • Real Name:Bobby
  • Location:/usa/kentucky/richmond/

Posted 09 May 2005 - 03:14 PM

bruyndoncx, on May 9 2005, 03:07 AM, said:

yes, that is it in your case.
If you use the SEO contribution, the page url doesn't have the products_id, but the pname parameter.
I'm not 100% familiar with this, but I guess if pname is truely uniquely identifyiing a product in your store, a similar conquery could be made to work in your case too ... [ chemo where are you ]

<{POST_SNAPBACK}>

I don't know what falvor of regex the plugin uses (PERL5, PCRE, etc.) but you can probably use the normal numeric character class like this:
showif="products_id=([0-9]+)"
This format and character class is used among every regex flavor I've ever used.

With respect to the cName/UltimateSEO URLs: the conversion to the cooresponding products_id and cPath is done at the script level so the plugin would only work with normal parameter driven URLs.  

Nice idea though Carine!

Bobby

#8   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 09 May 2005 - 09:30 PM

thanks chemo, I knew I could rely on you !
for pointing out the regular regex, I knew I wasn't using the most popular convention, but I was happy that it worked ...

but somehow, the conquery showif is not working for me yet ...
not sure if it is a bug in conquery. I guess as long as it is not correctly behaving based on the context, releasing this as a contribution is only gonna give more trouble.

In the meantime, feel free to use it asis (no warranty :D) and do let me know if you find out how to make it truely context sensitive, ie only showing on pages where there is a products_id in the url ...
Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#9   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 10 May 2005 - 08:55 PM

another regex question ... how do you extract the category id out of the cPath variable ?

eg cPath=46_63

what is the syntax to select the last number in the string following cPath where numbers are delimited by '_' (I don't want it to find a product_id later on in the string ...)
Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#10   NHRAFan

NHRAFan
  • Members
  • 63 posts
  • Real Name:Brent Friar

Posted 11 May 2005 - 01:10 AM

Wow. This is a GREAT tool, particularly if you have a store with a lot of products and categories. I tuned up your code a litte bit, but I am still trying to figure out the showif part. Right now it shows up all the time, but it works like a charm. Here is the fixed code:

# Mozilla/osCommerce plug-in by Carine Bruyndoncx (info@calimeross.com)
# Tuned up by Brent Friar (bf@dougherbert.com)
# osCommerce Edit Product

<search
name="osC edit Product"
description="Edit current product"
method="GET"
action="http://[:host]/catalog/admin/categories.php"
category="osCommerce"
showiftarget="[:linkurl]"
showif="cPath=(.*)&products_id=([0-9]+)"
queryEncoding="utf-8"
queryCharset="utf-8"
>
<input name="cPath" value="[:matched:1]">
<input name="pID" value="[:matched:2]">
<input name="action" value="new_product">

</search>
This preserves the categories so you can edit product and keep it where it belongs. I'll let you know if I figure out the showif deal.

Edited by NHRAFan, 11 May 2005 - 01:10 AM.


#11   NHRAFan

NHRAFan
  • Members
  • 63 posts
  • Real Name:Brent Friar

Posted 11 May 2005 - 01:25 AM

When in doubt, read the directions. The showif parameter is only used to get the regex for the output of the plugin, the plugin will ALWAYS show, even if there are no matches in the selection. That is unless you set it to only show when there is a match.

Right click to bring up the context menu, then double click on "Query to...". This will bring up the properties for the plugin. Find the osC edit Product selection in the list and make sure that you click the checkbox under "Show?" OFF. Now you will only get the osC option when you get a regex match.

The downside is that you can't really use it if you have SEO URLs installed. In my case, I have SEO installed, but I have too many products for the products cache. I disabled the products cache, but I still have manufacturers and categories enabled. This means I get to use both ;)

This would be a handy too to edit your store with even if you have SEO URLs. All you need to do is disable the products cache when you want to do your editing.

Find this line in includes/seo_cache.php:
$cache->save_cache($cache_file . 'products', $prod_cache, 'EVAL', 1 , 1);

And replace it with:
$cache->save_cache($cache_file . 'products', $prod_cache, 'EVAL', 1 , 0);

Then simply reset the cache through your admin. Now your products will have standard links and work with your ConQuery plugin. When you are done editing, switch the code back and reset your cache again to fully enable SEO URLs again.

Edited by NHRAFan, 11 May 2005 - 01:26 AM.


#12   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 11 May 2005 - 07:42 AM

NHRAFAn, BigThanks !
I missed that completely, I assumed there would be a way to turn a query completely off, not even context sensitive - yup, should have read more carefully.

For the categories, I've tried different things, but it either worked only in the main, or only in the subcategory, maybe I just take the stupid route and create clones. With the showif working, there is always only one showing ... :D
Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->

#13   NHRAFan

NHRAFan
  • Members
  • 63 posts
  • Real Name:Brent Friar

Posted 11 May 2005 - 12:34 PM

I was thinking about this last night because I would like to be able to do the same thing with categories and manufacturers, and I am pretty sure it can be done with SEO URL support. The idea would be to send the query to a NEW page that will parse out the -c-, -p-, and -m-, then send it to the appropriate page edit page in the admin. That would save all the trouble of turning off SEO URLs just to do editing. Not high on the priority list, but I'll take a look at a hack for this when I get a moment or 2.

#14   zipper

zipper
  • Members
  • 100 posts
  • Real Name:Henrik

Posted 13 July 2005 - 06:01 PM

This is a great idea.
Since reading about this on the forums I have made several scripts that makes working with the shop alot faster. (I'm on dialup from time to time). No more reloads just to get the right product selected in the categories area. Just rightclick to edit product, or attributes, or add a new one.

I like it, plain and simple. :)
Try it.

Zipper
"Those who say it can't be done should get out of the way of those who are doing it."
I will not always answer quick since I have alot of work at the moment.
My Contributions:
** Control New Products Mod
** Contact Alert Mod

#15   bruyndoncx

bruyndoncx

    Problem Thinker

  • Members
  • 2,691 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 13 July 2005 - 10:36 PM

I agree :D
BTW, nice signature !
Hava a nice day !
Carine Bruyndoncx


PS frustraded by the lack of feedback
<!--
Did you know 99% of all people benefiting from my posts, won't bother to repay the favor.
Wouldn't it be great if you are part of that exclusive 1% ?
post your findings in my responsive liive shop review thread ?
-->