Shop
class is a controller that manages various shop-related operations, including customer registration, cart management, checkout process, and order processing.
Class Properties
Protected property to store shop-related data.
Stripe secret key for payment processing.
Stripe public key for payment processing.
Prefix used for bill identification.
Token for ABEI API authentication.
URL for ABEI API endpoint.
Constructor
The constructor initializes the class, loads necessary models, and sets up important properties.Methods
sendABEI
The ID of the order to be sent to ABEI.
customer_registration
Loads the customer registration view.register_customer
Handles the customer registration process.Indicates whether the registration was successful.
Message describing the result of the registration process.
sendMailCustomerRegistration
Customer registration data.
Email address of the registered customer.
confirm_registration
Confirmation token for the registration.
customer_login
Handles customer login process.Indicates whether the login was successful.
Message describing the result of the login process.
customer_logout
Handles customer logout process.Always returns true upon successful logout.
removePromoCode
Removes the applied promo code from the current session and cart.addPromoCode
The promo code to be applied.
Indicates whether the promo code was successfully applied.
Message describing the result of applying the promo code.
stripeWebhook
Handles Stripe webhook events for payment processing.stripeInit
The amount to be charged in cents.
The ID of the order being processed.
A token for redirecting after payment.
The URL for the Stripe Checkout session.
load_view
The name of the view to be loaded.
Data to be passed to the view.
getRandomInteger
The minimum value of the range.
The maximum value of the range.
The generated random integer.
cart_view
Loads the cart view with current cart data and applied promotions.checkout
Processes the checkout form submission and initiates the payment process.clearCart
Clears the current cart and removes any applied promo code.getCartItemCount
Optional message to be included in the response.
Always returns true.
The optional message passed to the method.
The number of items in the cart.
getCartTotal
Returns the total value of items in the cart.The total value of the cart, formatted as a string with two decimal places.
removeFromCart
The row ID of the item to be removed from the cart.
Always returns true.
The row ID of the removed item.
Always returns 0.
The new total value of the cart after removal.
addToCart
Adds an item to the cart.The ID of the product to be added.
The quantity of the product to be added.
The type of the product being added.
updateItemCartQty
Updates the quantity of an item in the cart.The row ID of the item to be updated.
The change in quantity (positive or negative).
Always returns true.
The row ID of the updated item.
The new quantity of the item.
The new total price for this item.
The new total net price for this item.
The new total tax for this item.
The new total value of the cart.
success
Handles the successful payment process.notification
Handles payment notification process (not used in Stripe integration).cancel
Handles cancelled payment process.error
Handles payment error process.pending
Handles pending payment process.shop_response
The message to be displayed in the response.
sendOrderConfirmation
The ID of the order to be confirmed.
The response from Amephias system.
Indicates whether the order includes a ticket.
sendOrderCustomer
The ID of the order to be sent to the customer.