Comments

rfay’s picture

You can change the title on top of the page currently, but you can't change the URL. You can change the title using stringoverrides module and the menu system.

Good idea though - somebody else requested that the URL be changeable.

DocMartin’s picture

Just to support ideas for customising stores; such as readily choosing name, URL.

Maybe also chance to add some intro text - where it might be useful to note that visitors can browse the store on the website, and will purchase directly from Amazon [no phishing!], at same prices as Amazon but some money helping support the site.

I wonder, too, about the default store product listings. I've looked at browsenodes, which don't look too specific, and maybe not so well supported by Amazon.
Might it be possible to populate store with a pre-set search? Or even combination of searches.

rfay’s picture

You can always use a specific hand-crafted URL to represent any search, of course.

Replacing the 'amazon_store' menu item just means going through the code and using a variable everywhere that 'amazon_store' appears in a menu item, then providing a configuration interface to that variable.

I tink you should be able to do anything you want with extra text because the .tpl.php files are all there to be copied to your theme and altered. You can do anything you want without touching the module.

Patches and contributions are welcome.

DocMartin’s picture

Ah, hadn't thought of the URL for populating the store! Just about to do just this. Thanks.

fm’s picture

Subscribing. Custom store name and URL are desirable to maintain consistency between the paths for Amazon module nodes (a custom content type) and the paths for the Amazon Store product detail page (and the shopping cart).

the_g_bomb’s picture

StatusFileSize
new27.55 KB

I have implemented a solution to this. It adds a field in the admin settings form that takes and saves a new store name.
It also creates a new url based on that store name.

At the moment it only removes spaces and lowercases the Store name, so we might want to implement a more robust solution to the url checking, could base something on the pathauto_cleanstring() function, but I thought I would do this much to judge the reaction to see if this is the right direction.

rfay’s picture

Wow, you are on fire! Looking forward to reviewing this.

-Randy

the_g_bomb’s picture

StatusFileSize
new28.62 KB

Missed a reference to the store name so have updated the patch

rfay’s picture

Status: Active » Needs review
tallsimon’s picture

subscribe - sorry don't have test site set up so cannot test, would love this feature

rfay’s picture

StatusFileSize
new29.17 KB

Excellent start, @the_g_bomb. This has been requested for ages, and you finally made it happen.

Here's my version. I used a global, load it in hook_init(), and allow the path to be altered in the admin config.

I'll be interested to see what you think of it.

We will have to put a change into Amazon module when this goes, because Amazon knows how to link to the Amazon Store page...

This will also have to be done for D7, and it will require a bit of work.

the_g_bomb’s picture

Issue with the patch:

diff --git amazon_store_details_panel.tpl.php amazon_store_details_panel.tpl.php
index 983ecab..e46bd73 100644
--- amazon_store_details_panel.tpl.php
+++ amazon_store_details_panel.tpl.php
@@ -54,6 +54,8 @@ function amazon_store_manufacturer_format($attributeType, $attributeValue) {
  *   The Attributes section from the original XML.
  */
 function amazon_store_participant_format($attributeType, $attributeValue, $allAttributes) {
+  global $_amazon_store_path;
+
   $search_index = ProductGroup2SearchIndex((string)$allAttributes->ProductGroup);
   $output = "";
   if (count($attributeValue) > 1) {
@@ -61,7 +63,7 @@ function amazon_store_participant_format($attributeType, $attributeValue, $allAt
   }
 
   foreach ($attributeValue as $value) {
-    $link = l((string)$value, 'amazon_store', array('attributes' => array('rel' => 'nofollow'), 'query'=> array((string)$attributeType => (string)$value, 'SearchIndex' => $search_index)));
+    $link = l((string)$value, $_amazon_store_path, array('attributes' => array('rel' => 'nofollow'), 'query'=> array((string)$attributeType => (string)$value, 'SearchIndex' => $search_index)));
     if ($multi) {
       $link = "<li>$link</li>";
     }

amazon_store_details_panel.tpl.php doesn't have any functions, other than that it looks fine and ignoring the above, the updated module works well, except for 1 instance that might have been missed as far as I can tell.

When On the item description if you click the link for the artist/author etc the original amazon_store is referenced.

In amazon_store.module around line 1954

<?php
function amazon_store_participant_format($attributeType, $attributeValue, $allAttributes) {
  $search_index = ProductGroup2SearchIndex((string)$allAttributes->ProductGroup);
  $output = "";
  if (count($attributeValue) > 1) {
    $multi = 1;
  }

  foreach ($attributeValue as $value) {
    $link = l((string)$value, 'amazon_store', array('attributes' => array('rel' => 'nofollow'), 'query'=> array((string)$attributeType => (string)$value, 'SearchIndex' => $search_index)));
?>

need to add the global to that function and change the last line to:

<?php 
    $link = l((string)$value, $_amazon_store_path, array('attributes' => array('rel' => 'nofollow'), 'query'=> array((string)$attributeType => (string)$value, 'SearchIndex' => $search_index)));
?>
the_g_bomb’s picture

StatusFileSize
new78.27 KB

Sorry this has taken a while, had a bout of illness and loads of work to contend with.

It contains some code tidy up as well.

the_g_bomb’s picture

StatusFileSize
new3.11 KB

And I quickly threw this together for the amazon module. There is a todo note in there as I wasn't able to fully check out what code I was editing and its effects. rfay you'll probably see what I mean and know by looking at it if it needs to change or not. Uncomment the change if needed or delete if required.

Thanks

rfay’s picture

Status: Needs review » Needs work

Thanks, @the_g_bomb. Glad you're feeling better!

I'm not sure how #14 (the Amazon module required fix) is going to go. I guess we need to change $_amazon_store_path to an API function. I just don't think sharing a global is going to work. I should have done that in the first place. Let's call it amazon_store_store_path(). It's what I should have done in the first place. It will then read a static which is loaded from a variable.

We'll then fix up Amazon after this patch goes in, and it can call amazon_store_store_path() to get the proper url.

If you can think of something better I'm open.

mthart’s picture

subscribe

rfay’s picture

Status: Needs work » Needs review
StatusFileSize
new78.01 KB

OK, thanks, @the_g_bomb. I took your #13 and just turned the global into a define() which seems more appropriate after all.

rfay’s picture

Status: Needs review » Fixed

And committed, because I don't want to have to chase HEAD with this any more. I created a major release before doing this, so hopefully we'll get some miles on this before the next significant release.

rfay’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)

Now, (ouch) we need to apply this patch to the D7 version. Sure hope for your help on that, @the_g_bomb. Thanks for all the great work on this!

rfay’s picture

rfay’s picture

Followup D6 patch to rebuild the menu when settings are saved. Already committed: http://drupal.org/cvs?commit=458846

letapjar’s picture

somehow once I installed these patches and change my amazon_store name, the menu items for the store and the shopping cart were simply deleted. I had to look in the code to see where the shopping cart menu item is supposed to point.

The dec 3 2010 release does not include the patches from this thread even though the notes on the project page indicate that this ability is part of the module. It would be nice if this was made clear. I had ran the patches myself - but some site admins might not be comfortable with this procedure.

Great module by the way!

rfay’s picture

This patch went in *after* the 6.x-2.1 release, so it's in the dev release but not in the 2.1 release. I updated the project page to make that clear.

I *tried* to make it so you didn't have to flush the cache to rebuild the menu cache after changing the name of the store (#21). Maybe I failed. Or maybe you were patching yourself instead of using the dev release and you only patched with #17. Anyway, if you clear all caches after changing the store name, your menus will reappear. But I thought I had dealt with that.

letapjar’s picture

Thanks for the clarification.

I was indeed manually applying the patches (alll of them not just 17) and somehow didn't even think of clearing caches. (though if #17 is applied wouldn't the menu_rebuild()) do just that? it ended up deleting my menu items and not creating the new ones. Not a big deal as I just manually re-created them.

When I was choosing what version of the module to install, I checked the release notes, but neither the regular version nor the dev version mentioned in the release notes that it included these commits. (maybe I should have understood that from the nightly backups but this part is a bit unclear to me since dev and full version had the same release date.)

pancho’s picture

Assigned: Unassigned » pancho
Category: feature » bug
Priority: Normal » Major

Now that the feature has been added to 6.x-2.x, I consider this a major bug to be fixed in 7.x-1.x and will take care of it within the next week.

pancho’s picture

I ported the feature to D7, however rebuilding the menu system didn't work in spite of the submit handler being called. The new path and/or name applied only after submitting the form twice.
First I thought, it might have something to do with the execution order, but the reason is something completely different:
The variables are sucessfully set and then the menu is in fact successfully rebuild. However, as the two constants AMAZON_STORE_PATH and AMAZON_STORE_STORE_NAME are only redefined after a new bootstrap, amazon_store_menu() is still fed with the old path and name. Only after the next bootstrap, they are updated and if the user submits again, it will be used for the menu rebuild.
So the constants may not be used in amazon_store_menu(). Rather we need to do a regular variable_get(), and then everything is fine.

pancho’s picture

StatusFileSize
new27.96 KB

Here's a port to D7 including the followup issue in #26. I left out mere codestyle fixes that didn't automatically apply.
This should apply to D6 just as well, but first of all I committed this to 7.x-1.x: http://drupal.org/cvs?commit=495858

pancho’s picture

Assigned: pancho » Unassigned
Category: bug » feature
Priority: Major » Normal
Status: Patch (to be ported) » Fixed
StatusFileSize
new3.15 KB

And here's the followup patch for D6, which is now committed as well: http://drupal.org/cvs?commit=495876.
Setting this back to a normal feature request and mark as fixed. Finally we're done with this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.