The Shop class is a controller that manages various shop-related operations, including customer registration, cart management, checkout process, and order processing.

Class Properties

shop
null

Protected property to store shop-related data.

stripe_secret
string

Stripe secret key for payment processing.

stripe_pk
string

Stripe public key for payment processing.

bill_prefix
string

Prefix used for bill identification.

abei_token
string

Token for ABEI API authentication.

abei_url
string

URL for ABEI API endpoint.

Constructor

The constructor initializes the class, loads necessary models, and sets up important properties.

Methods

sendABEI

order_id
integer

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.

success
boolean

Indicates whether the registration was successful.

msg
string

Message describing the result of the registration process.

sendMailCustomerRegistration

data
array

Customer registration data.

user_email
string

Email address of the registered customer.

Sends a confirmation email to the newly registered customer.

confirm_registration

token
string

Confirmation token for the registration.

Confirms a customer’s registration using the provided token.

customer_login

Handles customer login process.

success
boolean

Indicates whether the login was successful.

msg
string

Message describing the result of the login process.

customer_logout

Handles customer logout process.

success
boolean

Always returns true upon successful logout.

removePromoCode

Removes the applied promo code from the current session and cart.

addPromoCode

promo_code
string

The promo code to be applied.

Applies a promo code to the current session.

success
boolean

Indicates whether the promo code was successfully applied.

msg
string

Message describing the result of applying the promo code.

stripeWebhook

Handles Stripe webhook events for payment processing.

stripeInit

amount
integer

The amount to be charged in cents.

order_id
integer

The ID of the order being processed.

treat_redirect_token
string

A token for redirecting after payment.

Initializes a Stripe Checkout session.

url
string

The URL for the Stripe Checkout session.

load_view

view
string

The name of the view to be loaded.

viewdata
array

Data to be passed to the view.

Loads a view with common data and settings.

getRandomInteger

min
integer

The minimum value of the range.

max
integer

The maximum value of the range.

Generates a random integer within the specified range.

integer
integer

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

message
string

Optional message to be included in the response.

Returns the current number of items in the cart.

success
boolean

Always returns true.

message
string

The optional message passed to the method.

count
integer

The number of items in the cart.

getCartTotal

Returns the total value of items in the cart.

total
string

The total value of the cart, formatted as a string with two decimal places.

removeFromCart

rowId
string

The row ID of the item to be removed from the cart.

Removes an item from the cart.

success
boolean

Always returns true.

rowid
string

The row ID of the removed item.

count
integer

Always returns 0.

total
string

The new total value of the cart after removal.

addToCart

Adds an item to the cart.

sid
integer

The ID of the product to be added.

qty
integer

The quantity of the product to be added.

type
string

The type of the product being added.

updateItemCartQty

Updates the quantity of an item in the cart.

rowId
string

The row ID of the item to be updated.

change
integer

The change in quantity (positive or negative).

success
boolean

Always returns true.

rowid
string

The row ID of the updated item.

count
integer

The new quantity of the item.

price
string

The new total price for this item.

price_net
string

The new total net price for this item.

price_tax
string

The new total tax for this item.

total
string

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

msg
string

The message to be displayed in the response.

Loads the shop response view with the given message.

sendOrderConfirmation

order_id
integer

The ID of the order to be confirmed.

amephias_response
string

The response from Amephias system.

has_ticket
boolean

Indicates whether the order includes a ticket.

Sends an order confirmation email to the shop.

sendOrderCustomer

order_id
integer

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.