| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Override XC/ProductVariant behavior and admin/customer content | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Override XC/ProductVariant behavior and admin/customer content
I'm new to X-Cart, though impressed with the high level of abstraction and encapsulation in the latest v5.3 release. I'm trying to figure out how to modify the store to include in critical feature for the way that I sell things, and I'd greatly appreciate some pointers to get me started. I've reviewed the developer docs, but it seems that they are mainly written for v5.2, and there are just enough changes in v5.3 that the existing resources aren't getting me over the hurdle of initial comprehension. I picked exactly the wrong time to dive into development.
To summarize my need, I have a variety of wireless module breakout boards, each with a least two and sometimes four or five variants. The attributes that define each variant need to be chosen in order, i.e. displayed or not based on a conditional hierarchy (feature #1). Also, variant stock left blank (i.e. default) needs to be calculated based on the hierarchy (feature #2), and some low-order attributes need to avoid limiting or subtracting stock (feature #3). I have product variants set up and working, but the behavior is too limited in light of what I need. For a live example, you can visit the following page which illustrates the requirement: https://www.jetney.com/x/ble113.html There are three attributes: Type, Flash Size, and Firmware. They should have the following hierarchy: - Type: PCB Only (stock qty defined, flash/firmware set to N/A) - Type: Assembled (stock qty defined, should be = 128k+256k stock) --- Flash Size: 128k (stock qty defined) ----- Firmware: Standard (stock qty NOT defined, =parent qty) ----- Firmware: Custom (stock qty NOT defined, =parent qty) --- Flash Size: 256k (stock qty defined) ----- Firmware: Standard (stock qty NOT defined, =parent qty) ----- Firmware: Custom (stock qty NOT defined, =parent qty) Five variants exist: 1. PCB Only -> N/A -> N/A 2. Assembled -> 128k -> Standard 3. Assembled -> 128k -> Custom 4. Assembled -> 256k -> Standard 5. Assembled -> 256k -> Custom If you select "PCB Only" for the Type option, then the "Flash Size" and "Firmware" options should disappear and be automatically set to the N/A option. If you select "Assembled" for the Type option, then "Flash Size" and "Firmware" should appear since they both apply when the board is assembled. However, the "Firmware" attribute is effectively infinite since it's a quick software change on my end. If I have 50 assembled 256k boards, then I don't want to manually say 25 are standard and 25 are custom firmware since all 50 of them could be either based only on what the customer selects. It matters because the customer FW option costs a bit extra due to the additional work involved. I am coming from Opencart, where I had some 3rd-party extensions in place to do this already. However, Opencart fell short in a couple of other ways, so now I'm trying to replicate the few important features not available in Core/Business. I'd love to make this into a module, since I think it has a lot of value for stores selling devices which are a combination of fixed-quantity material and customizable final configurations. I've looked at this forum post: https://forum.x-cart.com/showthread.php?t=75402 ...and I think it probably has the information that I need, but I've tried a few things and so far been unable to make it work at all. I'm sure it's user error on my part. I am fairly certain that at least a significant part of what I need to do concerns overriding the XC\ProductVariants module in some ways, but while I can see my changes by directly editing those source files, I'd much rather use a clean add-on module approach. For a single concrete question that should help me get started, how would I go about implementing (in my module) a change so that this template: \skins\customer\modules\XC\ProductVariants\product \attribute_value\select\option.twig ...is effectively overridden by what I have in my module's correlated location: \skins\customer\modules\Jetney\DependentAttributes \product\attribute_value\select\option.twig I've determined that I can get closer to my goal simply by allowing all editable attribute options to be selected at all times--removing the ProductVariants behavior of turning unavailable variant combination option choices into "optgroup" tags. If I can make my module do that, I'll be off to a good start. Thanks! Jeff
__________________
X-Cart 5.3.3.3 All stock, no custom mods |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Override XC/ProductVariant behavior and admin/customer content
You have two options:
1. Find the widget class that displays the option.twig template (it is classes/XLite/Module/XC/ProductVariants/View/Product/AttributeValue/Customer/Select.php), "decorate" it from your custom module and make it use your custom template instead of the original option.twig 2. Use the ability to define custom template directories and make X-Cart look for the template in your directory first.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|