Posts: 24
Threads: 1
Joined: Dec 2018
oh, wow, thanks for pointing out the oblivious! i had a mix of catalog and catelog! now it all seems to work, and your post for the multiple images also works.
Thanks for your help!
Posts: 24
Threads: 1
Joined: Dec 2018
though, now i see that when uploading more than 3 images for an item i get a 500 error, any ideas about that?
Posts: 538
Threads: 12
Joined: May 2013
Posts: 538
Threads: 12
Joined: May 2013
Any server restrictions or settings?
Posts: 24
Threads: 1
Joined: Dec 2018
2018-12-21, 01:38:34
(This post was last modified: 2018-12-21, 01:38:58 by usderofit.)
nope, this server used to run wordpress before so it should be all ok.
The images do seem to upload, just the front end doesnt show them, it give a 500 error
Posts: 538
Threads: 12
Joined: May 2013
look at the server logs - 500 is an internal server error.
Posts: 24
Threads: 1
Joined: Dec 2018
i have been told by support from the server that the problem is coming from the htaccess file from the cms, but this only hapens when adding more than 3 images to an item
Posts: 538
Threads: 12
Joined: May 2013
I can't imagine what the number of pictures has to do with .htaccess.
Posts: 24
Threads: 1
Joined: Dec 2018
niether can i, thats what the support team said when i asked, they said that the 500 error is because of the htaccess file.
Any ideas though? what would be the difference between having 3 images and 4 images?
Posts: 24
Threads: 1
Joined: Dec 2018
i figured it out!
in the config.php there is this line:
$config->itemDetailsImageSizes = array(
0 => array('w' => 600, 'h' => 600),
1 => array('w' => 300, 'h' => 300),
2 => array('w' => 300, 'h' => 300)
);
it has only 3 images, when i add a fourth:
3 => array('w' => 300, 'h' => 300)
It works, and i can have 4 images.
So im guessing this line of code is limiting the number of images you can have by how many images you set there.
So, how do we make this not be a "max" amount?
Posts: 538
Threads: 12
Joined: May 2013
2018-12-21, 04:39:55
(This post was last modified: 2018-12-21, 04:40:35 by Bigin.)
If you want all images to be the same size, just change the getResizedUrl() function in your hook from:
PHP Code: $path_r = \ImCatalog\Util::getResizedUrl($currentItem, $key, $this->processor->config->itemDetailsImageSizes[$key]['w'], $this->processor->config->itemDetailsImageSizes[$key]['h'], 'resize' );
to:
PHP Code: $path_r = \ImCatalog\Util::getResizedUrl($currentItem, $key, $this->processor->config->itemDetailsImageSizes[0]['w'], $this->processor->config->itemDetailsImageSizes[0]['h'], 'resize' );
Or whatever you want ...
Posts: 24
Threads: 1
Joined: Dec 2018
thats not what i was saying.
The issue is that the array only has 3 items in it, and because of this there are only 3 images that show on the front end, and adding a fourth gives a 500 error.
When you add another item to the array, the fourth image shows.
So the array is limiting the amount of images that can be shown on the front end.
Thats what needs to be fixed.
Is there a way to make the array not limit the amount of images?
Posts: 538
Threads: 12
Joined: May 2013
Have you tried what I wrote? - if not please do it!
I know what you meant: this array contains variable information to display the images in different sizes. With the specification of ...
Code: $this->processor->config->itemDetailsImageSizes[0]['w'],
$this->processor->config->itemDetailsImageSizes[0]['h'],
... only the first array element is used for all images and there should be no more errors.
Posts: 24
Threads: 1
Joined: Dec 2018
yes i tried it, it didnt work
Posts: 538
Threads: 12
Joined: May 2013
That tells us the problem is somewhere else.
Is GSDEBUG set to 'true'?
Please post GS log here after calling the site.
Posts: 24
Threads: 1
Joined: Dec 2018
where do i check if its set to true?
Posts: 24
Threads: 1
Joined: Dec 2018
nevermind, figured it out.
Its on, when i reload the page i get this error:
Notice: Undefined offset: 3 in /home/content/94/8651994/html/dev/products/plugins/im_sc_extender.php on line 72
Notice: Undefined offset: 3 in /home/content/94/8651994/html/dev/products/plugins/im_sc_extender.php on line 73
Fatal error: Uncaught exception 'InvalidArgumentException' with message '$maxWidth must be numeric' in /home/content/94/8651994/html/dev/products/plugins/imanager/phpthumb/GdThumb.inc.php:172 Stack trace: #0 /home/content/94/8651994/html/dev/products/plugins/im_simple_catalog/inc/_Util.php(64): GdThumb->resize(NULL, NULL) #1 /home/content/94/8651994/html/dev/products/plugins/im_sc_extender.php(75): ImCatalog\Util::getResizedUrl(Object(SimpleItem), 3, NULL, NULL, 'resize') #2 /home/content/94/8651994/html/dev/products/plugins/im_sc_extender.php(39): ExtendedController->getTemplate(Object(SimpleItem)) #3 /home/content/94/8651994/html/dev/products/plugins/im_sc_extender.php(25): ExtendedController->renderFrontendItemDetails() #4 /home/content/94/8651994/html/dev/products/plugins/im_simple_catalog/lib/controller.php(523): ExtendedController->renderSection('FrontendItemDet...') #5 /home/content/94/8651994/html/dev/products/plugins/im_simple_catalog/lib/controller.php(258): ImCatalog\Controller->__renderFrontendItemDetailsConte in /home/content/94/8651994/html/dev/products/plugins/imanager/phpthumb/GdThumb.inc.php on line 172
Posts: 24
Threads: 1
Joined: Dec 2018
ok, i understand, i used your solution of changing $key to 0 in the actual plugin, and not in the extender, now i did it in the extender and it works
Posts: 538
Threads: 12
Joined: May 2013
Yeah, that was meant in the "hook" ...
Posts: 24
Threads: 1
Joined: Dec 2018
great, all seems to work now, thanks for your help!
Posts: 24
Threads: 1
Joined: Dec 2018
is there a way to add a custom field to all categories?
I saw the instructions in a link you posted, but that`s for adding a custom field for each category manually and individually, is there a way to add one for all categories?
Posts: 24
Threads: 1
Joined: Dec 2018
what im trying to do is to use the categories as "sub categories", and to group them into actual categories on the page based on the custom fields.
So, i would create 4 categories for example, for 2 i would give a custom field value of "cat a", and for the other 2 i would give the custom field value "cat b", and on the catelog page i would display them grouped together based on the custom field value.
Is this possible?
Posts: 538
Threads: 12
Joined: May 2013
Hello,
(2018-12-27, 00:00:14)usderofit Wrote: is there a way to add a custom field to all categories?
You can simply use SC API to add your field to the categories. Here is an example that you can use to do this, but remember to adjust the '$fieldname' parameter:
https://gist.github.com/bigin/c7634296a4...0535a4afc5
(2018-12-27, 03:15:21)usderofit Wrote: So, i would create 4 categories for example, for 2 i would give a custom field value of "cat a", and for the other 2 i would give the custom field value "cat b", and on the catelog page i would display them grouped together based on the custom field value.
I don't know exactly what you're doing, aren't you able to do that with the already existing Tags field?
Posts: 24
Threads: 1
Joined: Dec 2018
2018-12-28, 03:37:22
(This post was last modified: 2018-12-28, 03:40:47 by usderofit.)
Thank you for the code, where exactly would i put it though?
And the Tags field are only in the items, not in the categories from what i see.
What i want is to group the categories, and add a header for each category group for example, so it would be something like:
Group 1:
-category a
--item a
--item b
-category b
--item a
--item b
--item c
etc.
I just want to group the categories on the front end, so what ever way that is possible is good.
Posts: 538
Threads: 12
Joined: May 2013
Okay, I get it, then the script will be of no use to you ... I'll take a look at it, then I'll get back to you.
|