Introduction
Controller for handling shop-related functionality
The 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.
Sends order data to the ABEI API. This method is currently not fully implemented.
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.
Sends a confirmation email to the newly registered customer.
confirm_registration
Confirmation token for the registration.
Confirms a customer’s registration using the provided token.
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.
Applies a promo code to the current session.
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.
Initializes a Stripe Checkout session.
The URL for the Stripe Checkout session.
load_view
The name of the view to be loaded.
Data to be passed to the view.
Loads a view with common data and settings.
getRandomInteger
The minimum value of the range.
The maximum value of the range.
Generates a random integer within the specified 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.
Returns the current number of items in the cart.
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.
Removes an item 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.
Loads the shop response view with the given message.
sendOrderConfirmation
The ID of the order to be confirmed.
The response from Amephias system.
Indicates whether the order includes a ticket.
Sends an order confirmation email to the shop.
sendOrderCustomer
The ID of the order to be sent to the customer.
Sends an order confirmation email to the customer.
create_pdf_mail_new
Creates a PDF for a new order.
create_pdf_mail
Creates a PDF for an order (older version).
create_pdf_bill
Creates a PDF bill for an order.
create_pdf_bill_mail
Creates a PDF bill for an order to be sent via email.
dompdf_test
Generates a test PDF using dompdf library.
dompdf_test_save_to_file
Generates a test PDF using dompdf library and saves it to a file.