Page 1 of 1

Still on XH_Shop

Posted: Mon Aug 19, 2019 3:39 pm
by milkodb
Hi Christoph and all who can give me an answer,
sorry if I continue to bother you with things that may seem trivial, but my ability to understand the code is rather elementary, after all I'm a graphic designer and not an expert programmer ...
Here is my need: I have to manage book stores where it is not important that the product is sold out because it can be reprinted upon customer's request against a minimum of requested copies (today with digital printing it is feasible). Using Wellrad I solved the problem by modifying the code without any particular difficulty. Now with XH_Shop I have managed to make sure that even a book classified as "not available" is shown in the catalog anyway and so far so good. What I had done previously was to create a condition for which if the product was not available it was shown in the catalog but not its block containing the elements for the order and a label was shown showing the book as " out of print but can be reprinted upon direct request via email ", etc. I thought I was using the same method used with Wellrad using "$ product ['isAvailable'] == false" to establish the condition. Unfortunately for my ineptitude neither this value nor ['stockOnHand'} are available in Catalog.php as they were in Wellrad and I can't find the way to retrieve the value of the condition "if available" in any way.
If you were so kind and helpful as to suggest me how to do it I would be grateful and at this point I think I should at least have a truck of beer ... :)

A couple of suggestions, even if for me it would not be big problems because I don't think it is difficult to do it alone, but I dare presumptuously to propose it if it can serve to improve the functionality of XH_Shop: when you make an order, the cart contains the elements ordered and all the mechanism proceeds correctly to allow the order to be paid. A button would be useful to allow the customer to delete items from the order before arriving at the conclusion and one that would allow the order to be canceled (or to cancel the order simply if all the items in the order were removed). Currently the only way I have found is to clear the browser cache and start over. Clearly it is not something understandable for any user.
Another observation concerns the fact that if you search for an article by entering data in the search field, there is no way to go back to the complete catalog list without selecting a category and then again "all categories", or by changing the page of the site and then returning to the store.
These are small suggestions, but they seem useful to make the store really "foolproof". And I as a "fool" am a great β tester ... :D

Thanks, really thanks.

Re: Still on XH_Shop

Posted: Mon Aug 19, 2019 4:44 pm
by frase
Hi, it's me again. :D
milkodb wrote:
Mon Aug 19, 2019 3:39 pm
Unfortunately for my ineptitude neither this value nor ['stockOnHand'} are available in Catalog.php ...
You didn't check that right, or you got the wrong version. This value exists.
In the catalog.php every article has that:

Code: Select all

$products['xxxxxxxxxxxx']['stock_on_hand'] = 1; // or 0
milkodb wrote:
Mon Aug 19, 2019 3:39 pm
when you make an order, the cart contains the elements ordered and all the mechanism proceeds correctly to allow the order to be paid. A button would be useful to allow the customer to delete items from the order before arriving at the conclusion and one that would allow the order to be canceled (or to cancel the order simply if all the items in the order were removed). Currently the only way I have found is to clear the browser cache and start over. Clearly it is not something understandable for any user.
cart-delete-button.png
This function is also available (see figure).
Always in the first step of the payment process.
You can return to this step at any time.
milkodb wrote:
Mon Aug 19, 2019 3:39 pm
Another observation concerns the fact that if you search for an article by entering data in the search field, there is no way to go back to the complete catalog list without selecting a category and then again "all categories", or by changing the page of the site and then returning to the store.
I'll say. That's actually a little inconvenience. You're right.
milkodb wrote:
Mon Aug 19, 2019 3:39 pm
These are small suggestions, but they seem useful to make the store really "foolproof". And I as a "fool" am a great β tester ... :D
We need people like that! :P

Do you know the XH-Shop Wiki?

Re: Still on XH_Shop

Posted: Mon Aug 19, 2019 5:59 pm
by frase
Ahhhh, that reminds me that you have taken over/converted old articles from the Wellrad. Of course 'stock_on_hand' could be missing there.
You might have to save each article at least once to fix it. (I don't know exactly :( )

Re: Still on XH_Shop

Posted: Mon Aug 19, 2019 7:23 pm
by milkodb
Yes, I know it exists. :D And no, "stockOnHand" continues to be present even after conversion. It is the only value always declared as numeric instead of a string and not an array. But in any way you try to recall it there is no answer.
It is clearly written in catalog.php as "stockOnHand". But if I try to call it in the "<? Php" foreach loop ($ this-> products as $ index => $ product) etc. in catalog.tpl, it is not recognized as an absolute value ("1" / "0" or 1/0) neither as a Boolean situation (true / false), nor as a simple print of the value nor even as a check in an "if" loop. So either I am not using the correct syntax to call it (but it is the same one that calls "name" and "teaser"), or something is not working and I don't know why. Not even trying to call the boolean on "isAvailable" ... :)

Re: Still on XH_Shop

Posted: Mon Aug 19, 2019 7:36 pm
by milkodb
Ah, ok. I've seen "delete article" button (x). Ok, I'm blind, this is why I play the fingerpickin blues well... :)
I enlarge it a bit with CSS, thanks...

Re: Still on XH_Shop

Posted: Mon Aug 19, 2019 8:02 pm
by frase
milkodb wrote:
Mon Aug 19, 2019 7:23 pm
But if I try to call it in the "<? Php" foreach loop ($ this-> products as $ index => $ product) etc. in catalog.tpl, it is not recognized as an absolute value ("1" / "0" or 1/0) neither as a Boolean situation (true / false), nor as a simple print of the value nor even as a check in an "if" loop. So either I am not using the correct syntax to call it (but it is the same one that calls "name" and "teaser"), or something is not working and I don't know why. Not even trying to call the boolean on "isAvailable" ... :)
I suspect that articles with "stock-on-hand=0" do not arrive at all in the catalog.tpl or are available.
Probably everything happens in the Product.php.
You will have to wait for Christoph again. :cry:

Re: Still on XH_Shop

Posted: Sat Aug 31, 2019 10:37 am
by cmb
milkodb wrote:
Mon Aug 19, 2019 7:23 pm
It is clearly written in catalog.php as "stockOnHand". But if I try to call it in the "<? Php" foreach loop ($ this-> products as $ index => $ product) etc. in catalog.tpl, it is not recognized as an absolute value ("1" / "0" or 1/0) neither as a Boolean situation (true / false), nor as a simple print of the value nor even as a check in an "if" loop. So either I am not using the correct syntax to call it (but it is the same one that calls "name" and "teaser"), or something is not working and I don't know why. Not even trying to call the boolean on "isAvailable" ... :)
Well, $product['isAvailable'] is supposed to be available in the foreach loop in catalog.tpl. For instance, you could insert after this line:

Code: Select all

<?php if (!$product['isAvailable']):?>
		<div>needs reprint</div>
<?php endif?>

Re: Still on XH_Shop

Posted: Wed Sep 11, 2019 1:36 pm
by milkodb
Ok Christoph, thanks a lot, it's allright.

I'm were wrong in commenting code to show the product also when non available in "Product.php", so product data array was distorted. Now I get this eliminating //if ($collectAll === false && $product->isAvailable() === false), ecc. in "Controller.php" and all is right.

If there's somethig you think is better, please tell me.

For now, thank for your patience. :)