Jump to content

Making a simple module with little php experience


Recommended Posts

Hello, 

I am new to the whole PrestaShop ecosystem. I do not know PHP, but i do know JavaScript, NodeJS, React and intermediate Java and C#.

I want to make a very simple module with the following requirements:

Lets say i have a shop that sells cables per rol.

I want the customer to be able to buy either per meter or per complete rol.

I want the module to do the following:

  • Take the price per rol
  • If customer wants to buy a complete rol, then display price per rol.
  • If customer wants to buy per meter, add X% to price per rol and calculate the price per meter including the percentage increase, then display price. 

Would something like that be difficult to implement and are there any security concerns I should be aware of?

Also where should I start? Should I start from the basics of PHP? Are there any resources that would teach me the syntax of PHP given that I already know other languages?

 

Link to comment
Share on other sites

Yeah, like @joseantgv  that definitely is not simple module to make and not the best to start with.

You can check if there is similar module here 

https://addons.prestashop.com/en/466-sizes-units

But also for your problem you may try other solution without making a module. Not sure if it would be possible 

but try to make 2 attributes: by roll and by meter. That could be radio buttons. Base product price could be 0 

and then impact on price for "by roll" attribute could be let say $100 for roll of 50m.  And for attribute "by meter" could have

impact for example $100 * 20% / 50m  = $2.4 per m.  

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...