diff --git a/PLAN.md b/PLAN.md index 5b26627..f33456c 100644 --- a/PLAN.md +++ b/PLAN.md @@ -549,27 +549,27 @@ Track completion per file. Mark with `[x]` when done. ### Phase 3 -- Single Product -- [ ] `single-product/product-image.html.twig` -- [ ] `single-product/title.html.twig` -- [ ] `single-product/price.html.twig` -- [ ] `single-product/short-description.html.twig` -- [ ] `single-product/meta.html.twig` -- [ ] `single-product/rating.html.twig` -- [ ] `single-product/stock.html.twig` -- [ ] `single-product/sale-flash.html.twig` -- [ ] `single-product/share.html.twig` -- [ ] `single-product/product-attributes.html.twig` -- [ ] `single-product/related.html.twig` -- [ ] `single-product/up-sells.html.twig` -- [ ] `single-product/add-to-cart/simple.html.twig` -- [ ] `single-product/add-to-cart/variable.html.twig` -- [ ] `single-product/add-to-cart/grouped.html.twig` -- [ ] `single-product/add-to-cart/external.html.twig` -- [ ] `single-product/add-to-cart/variation.html.twig` -- [ ] `single-product/add-to-cart/variation-add-to-cart-button.html.twig` -- [ ] `single-product/tabs/tabs.html.twig` -- [ ] `single-product/tabs/description.html.twig` -- [ ] `single-product/tabs/additional-information.html.twig` +- [x] `single-product/product-image.html.twig` +- [x] `single-product/title.html.twig` +- [x] `single-product/price.html.twig` +- [x] `single-product/short-description.html.twig` +- [x] `single-product/meta.html.twig` +- [x] `single-product/rating.html.twig` +- [x] `single-product/stock.html.twig` +- [x] `single-product/sale-flash.html.twig` +- [x] `single-product/share.html.twig` +- [x] `single-product/product-attributes.html.twig` +- [x] `single-product/related.html.twig` +- [x] `single-product/up-sells.html.twig` +- [x] `single-product/add-to-cart/simple.html.twig` +- [x] `single-product/add-to-cart/variable.html.twig` +- [x] `single-product/add-to-cart/grouped.html.twig` +- [x] `single-product/add-to-cart/external.html.twig` +- [x] `single-product/add-to-cart/variation.html.twig` +- [x] `single-product/add-to-cart/variation-add-to-cart-button.html.twig` +- [x] `single-product/tabs/tabs.html.twig` +- [x] `single-product/tabs/description.html.twig` +- [x] `single-product/tabs/additional-information.html.twig` ### Phase 4 -- Cart diff --git a/assets/css/wc-bootstrap.css b/assets/css/wc-bootstrap.css index ee33114..da10b58 100644 --- a/assets/css/wc-bootstrap.css +++ b/assets/css/wc-bootstrap.css @@ -144,6 +144,40 @@ font-weight: 600; } +/* ========================================================================== + Product Gallery + Thumbnail grid and cursor for single product image gallery. + ========================================================================== */ + +.wc-gallery-thumb { + cursor: pointer; + opacity: 0.7; + transition: opacity 0.15s ease; +} + +.wc-gallery-thumb:hover { + opacity: 1; +} + +.woocommerce-product-gallery__image img { + width: 100%; + height: auto; + border-radius: var(--bs-border-radius); +} + +/* ========================================================================== + Variation Selectors + Spacing for variable product attribute dropdowns. + ========================================================================== */ + +.variations_form .reset_variations { + font-size: 0.875rem; +} + +.single_variation_wrap .woocommerce-variation { + margin-bottom: 1rem; +} + /* ========================================================================== WooCommerce Grid Override Reset WooCommerce's default grid to let Bootstrap handle layout. diff --git a/templates/single-product/add-to-cart/external.html.twig b/templates/single-product/add-to-cart/external.html.twig new file mode 100644 index 0000000..722473f --- /dev/null +++ b/templates/single-product/add-to-cart/external.html.twig @@ -0,0 +1,32 @@ +{# + # External/Affiliate Product Add to Cart (Bootstrap 5 Override) + # + # Renders a link button to the external product URL. + # + # Expected context: + # product_url - External product URL + # button_text - Button label text + # + # WooCommerce PHP equivalent: single-product/add-to-cart/external.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_add_to_cart_form') }} + +
+ +{{ do_action('woocommerce_after_add_to_cart_form') }} diff --git a/templates/single-product/add-to-cart/grouped.html.twig b/templates/single-product/add-to-cart/grouped.html.twig new file mode 100644 index 0000000..61efdea --- /dev/null +++ b/templates/single-product/add-to-cart/grouped.html.twig @@ -0,0 +1,84 @@ +{# + # Grouped Product Add to Cart (Bootstrap 5 Override) + # + # Add-to-cart form for grouped products: table of child products with quantities. + # + # Expected context: + # product - WC_Product_Grouped object + # grouped_products - Array of child WC_Product objects + # grouped_product_columns - Array of column definitions + # quantites_required - Whether quantities are required + # show_add_to_cart_button - Whether to show the submit button + # + # WooCommerce PHP equivalent: single-product/add-to-cart/grouped.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_add_to_cart_form') }} + + + +{{ do_action('woocommerce_after_add_to_cart_form') }} diff --git a/templates/single-product/add-to-cart/simple.html.twig b/templates/single-product/add-to-cart/simple.html.twig new file mode 100644 index 0000000..b94db2e --- /dev/null +++ b/templates/single-product/add-to-cart/simple.html.twig @@ -0,0 +1,53 @@ +{# + # Simple Product Add to Cart (Bootstrap 5 Override) + # + # Add-to-cart form for simple products: quantity input + button. + # + # Expected context: + # product - WC_Product_Simple object + # + # WooCommerce PHP equivalent: single-product/add-to-cart/simple.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% if product.is_purchasable() and product.is_in_stock() %} + {{ do_action('woocommerce_before_add_to_cart_form') }} + + + + {{ do_action('woocommerce_after_add_to_cart_form') }} +{% endif %} diff --git a/templates/single-product/add-to-cart/variable.html.twig b/templates/single-product/add-to-cart/variable.html.twig new file mode 100644 index 0000000..6d28fbf --- /dev/null +++ b/templates/single-product/add-to-cart/variable.html.twig @@ -0,0 +1,88 @@ +{# + # Variable Product Add to Cart (Bootstrap 5 Override) + # + # Add-to-cart form for variable products with attribute selectors. + # + # Expected context: + # product - WC_Product_Variable object + # attributes - Array of attribute taxonomies + # available_variations - JSON-encoded variations data + # attribute_keys - Array of attribute keys + # variations_json - Variations data as JSON string + # variations_attr - Data attribute string for the form + # selected_attributes - Currently selected attribute values + # + # WooCommerce PHP equivalent: single-product/add-to-cart/variable.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_add_to_cart_form') }} + + + +{{ do_action('woocommerce_after_add_to_cart_form') }} diff --git a/templates/single-product/add-to-cart/variation-add-to-cart-button.html.twig b/templates/single-product/add-to-cart/variation-add-to-cart-button.html.twig new file mode 100644 index 0000000..65f4360 --- /dev/null +++ b/templates/single-product/add-to-cart/variation-add-to-cart-button.html.twig @@ -0,0 +1,51 @@ +{# + # Variation Add to Cart Button (Bootstrap 5 Override) + # + # Renders the quantity input and add-to-cart button for variable products + # after variation selection. + # + # Expected context: + # product - WC_Product_Variable object + # + # WooCommerce PHP equivalent: single-product/add-to-cart/variation-add-to-cart-button.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + + diff --git a/templates/single-product/add-to-cart/variation.html.twig b/templates/single-product/add-to-cart/variation.html.twig new file mode 100644 index 0000000..0e5e800 --- /dev/null +++ b/templates/single-product/add-to-cart/variation.html.twig @@ -0,0 +1,30 @@ +{# + # Variation Templates (Bootstrap 5 Override) + # + # JavaScript templates (Underscore.js syntax) used by WooCommerce to render + # variation details dynamically when a user selects product attributes. + # These are script templates, not rendered server-side. + # + # WooCommerce PHP equivalent: single-product/add-to-cart/variation.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + + + + diff --git a/templates/single-product/meta.html.twig b/templates/single-product/meta.html.twig new file mode 100644 index 0000000..6f83da7 --- /dev/null +++ b/templates/single-product/meta.html.twig @@ -0,0 +1,41 @@ +{# + # Product Meta (Bootstrap 5 Override) + # + # Renders SKU, categories, and tags as a definition list. + # + # Expected context: + # product - WC_Product object with: + # .get_sku() - SKU string + # .get_id() - Product ID + # sku - SKU string (fallback) + # categories_html - Pre-rendered category links HTML + # tags_html - Pre-rendered tag links HTML + # + # WooCommerce PHP equivalent: single-product/meta.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + + diff --git a/templates/single-product/price.html.twig b/templates/single-product/price.html.twig new file mode 100644 index 0000000..f740cfa --- /dev/null +++ b/templates/single-product/price.html.twig @@ -0,0 +1,16 @@ +{# + # Product Price (Bootstrap 5 Override) + # + # Expected context: + # product - WC_Product object with: + # .get_price_html() - Formatted price HTML + # + # WooCommerce PHP equivalent: single-product/price.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + ++ {{ product.get_price_html()|raw }} +
diff --git a/templates/single-product/product-attributes.html.twig b/templates/single-product/product-attributes.html.twig new file mode 100644 index 0000000..f9a4e4f --- /dev/null +++ b/templates/single-product/product-attributes.html.twig @@ -0,0 +1,32 @@ +{# + # Product Attributes Table (Bootstrap 5 Override) + # + # Renders product attributes as a Bootstrap striped table. + # + # Expected context: + # product_attributes - Array of attribute objects, each with: + # .label - Attribute label + # .value - Attribute value (HTML) + # + # WooCommerce PHP equivalent: single-product/product-attributes.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% if product_attributes is defined and product_attributes|length > 0 %} +| + {{ attribute.label|esc_html }} + | ++ {{ attribute.value|raw }} + | +
|---|
+ {{ availability|esc_html }} +
+{% endif %} diff --git a/templates/single-product/tabs/additional-information.html.twig b/templates/single-product/tabs/additional-information.html.twig new file mode 100644 index 0000000..da30767 --- /dev/null +++ b/templates/single-product/tabs/additional-information.html.twig @@ -0,0 +1,22 @@ +{# + # Additional Information Tab Content (Bootstrap 5 Override) + # + # Renders the product attributes table inside the Additional Information tab. + # + # Expected context: + # product - WC_Product object + # heading - Tab heading text (filtered) + # + # WooCommerce PHP equivalent: single-product/tabs/additional-information.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set heading = heading|default(__('Additional information')) %} + +{% if heading %} +